Commit 23b1a716 authored by Contactu&Shefu's avatar Contactu&Shefu

assessment

parents
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-14">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
This diff is collapsed.
content_assist_proposals_background=255,255,255
content_assist_proposals_foreground=0,0,0
eclipse.preferences.version=1
org.eclipse.jdt.ui.formatterprofiles.version=20
spelling_locale=en_GB
spelling_locale_initialized=true
useAnnotationsPrefPage=true
useQuickDiffPrefPage=true
eclipse.preferences.version=1
org.eclipse.jsch.core.hasChangedDefaultWin32SshHome=true
eclipse.preferences.version=1
org.eclipse.m2e.discovery.pref.projects=
eclipse.preferences.version=1
org.eclipse.mylyn.monitor.activity.tracking.enabled.checked=true
eclipse.preferences.version=1
migrated.task.repositories.secure.store=true
org.eclipse.mylyn.tasks.ui.filters.nonmatching=true
org.eclipse.mylyn.tasks.ui.filters.nonmatching.encouraged=true
org.eclipse.mylyn.tasks.ui.welcome.message=true
PROBLEMS_FILTERS_MIGRATE=true
eclipse.preferences.version=1
platformState=1605386535439
quickStart=false
tipsAndTricks=true
//org.eclipse.ui.commands/state/org.eclipse.ui.navigator.resources.nested.changeProjectPresentation/org.eclipse.ui.commands.radioState=false
PLUGINS_NOT_ACTIVATED_ON_STARTUP=;org.eclipse.m2e.discovery;
eclipse.preferences.version=1
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_END=255,255,255
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_BG_START=255,255,255
org.eclipse.ui.workbench.ACTIVE_NOFOCUS_TAB_TEXT_COLOR=16,16,16
org.eclipse.ui.workbench.ACTIVE_TAB_BG_END=255,255,255
org.eclipse.ui.workbench.ACTIVE_TAB_BG_START=255,255,255
org.eclipse.ui.workbench.INACTIVE_TAB_BG_START=242,242,242
eclipse.preferences.version=1
processedSchemes=,eclipse+command,eclipse+mpc
This source diff could not be displayed because it is too large. You can view the blob instead.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<typeInfoHistroy/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<qualifiedTypeNameHistroy/>
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart">
<item key="group_libraries" value="true"/>
<item key="layout" value="2"/>
<item key="rootMode" value="1"/>
<item key="linkWithEditor" value="false"/>
<item key="memento" value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#x0D;&#x0A;&lt;packageExplorer group_libraries=&quot;1&quot; layout=&quot;2&quot; linkWithEditor=&quot;0&quot; rootMode=&quot;1&quot; workingSetName=&quot;Aggregate for window 1620944838604&quot;&gt;&#x0D;&#x0A;&lt;customFilters userDefinedPatternsEnabled=&quot;false&quot;&gt;&#x0D;&#x0A;&lt;xmlDefinedFilters&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.StaticsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.buildship.ui.packageexplorer.filter.gradle.buildfolder&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonSharedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyInnerPackageFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.m2e.MavenModuleFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.buildship.ui.packageexplorer.filter.gradle.subProject&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ClosedProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.EmptyLibraryContainerFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.PackageDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.BinaryProjectFilter1&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LocalTypesFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.pde.ui.ExternalPluginLibrariesFilter1&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.FieldsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaProjectsFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer_patternFilterId_.*&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.SyntheticMembersFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ContainedLibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.HideInnerClassFilesFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.DeprecatedMembersFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.ImportDeclarationFilter&quot; isEnabled=&quot;true&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonJavaElementFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.LibraryFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.CuAndClassFileFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.internal.ui.PackageExplorer.EmptyPackageFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;child filterId=&quot;org.eclipse.jdt.ui.PackageExplorer.NonPublicFilter&quot; isEnabled=&quot;false&quot;/&gt;&#x0D;&#x0A;&lt;/xmlDefinedFilters&gt;&#x0D;&#x0A;&lt;/customFilters&gt;&#x0D;&#x0A;&lt;/packageExplorer&gt;"/>
</section>
</section>
<?xml version="1.0" encoding="UTF-8"?>
<setup:Workspace
xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:setup="http://www.eclipse.org/oomph/setup/1.0"
name="workspace"/>
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="SmartImportWizard">
<item key="SmartImportRootWizardPage.STORE_HIDE_ALREADY_OPEN" value="false"/>
<item key="SmartImportRootWizardPage.STORE_CLOSE_IMPORTED" value="false"/>
<item key="SmartImportRootWizardPage.STORE_NESTED_PROJECTS" value="true"/>
<item key="SmartImportRootWizardPage.STORE_CONFIGURE_NATURES" value="true"/>
</section>
</section>
<?xml version="1.0" encoding="UTF-8"?>
<state reopen="false"/>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<section name="Workbench">
<section name="ImportExportAction">
</section>
<section name="FileSystemImportWizard">
</section>
</section>
<?xml version="1.0" encoding="UTF-8"?>
<workingSetManager>
<workingSet editPageId="org.eclipse.jdt.internal.ui.DynamicSourcesWorkingSet" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1620944831823_0" label="Java Main Sources" name="Java Main Sources"/>
<workingSet editPageId="org.eclipse.jdt.internal.ui.DynamicSourcesWorkingSet" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1620944831865_1" label="Java Test Sources" name="Java Test Sources"/>
<workingSet aggregate="true" factoryID="org.eclipse.ui.internal.WorkingSetFactory" id="1620944838604_2" label="Window Working Set" name="Aggregate for window 1620944838604"/>
</workingSetManager>
\ No newline at end of file
#Thu May 13 23:27:03 BST 2021
org.eclipse.core.runtime=2
org.eclipse.platform=4.17.0.v20200902-1800
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>YorkStJohnZoo</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=14
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=14
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=14
module yorkStJohnZoo {
}
\ No newline at end of file
package yorkStJohnZoo;
public class Animals {
String name, kingdom, food, environment;
double lifetime, weight;
public Animals(String name, String kingdom, String food, String environment, double lifetime, double weight){
this.name = name;
this.kingdom = kingdom;
this.food = food;
this.environment = environment;
this.lifetime = lifetime;
this.weight = weight;
}
}
\ No newline at end of file
package yorkStJohnZoo;
public class Birds extends Animals {
public Birds(String n, String k, String f, String e, double l, double w) {
super(n, k, f, e, l, w);
// TODO Auto-generated constructor stub
}
}
\ No newline at end of file
package yorkStJohnZoo;
public class Fish extends Animals {
public Fish(String n, String k, String f, String e, double l, double w) {
super(n, k, f, e, l, w);
// TODO Auto-generated constructor stub
}
}
package yorkStJohnZoo;
public class Mammals extends Animals {
public Mammals(String name, String kingdom, String food, String environment, double lifetime, double weight) {
super(name, kingdom, food, environment, lifetime, weight);
// TODO Auto-generated constructor stub
}
}
\ No newline at end of file
package yorkStJohnZoo;
import java.util.Scanner; // import a facility for getting input
import java.util.ArrayList; // import the ArratList class
import java.util.List;
public class OnlineZoo {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
int choice;
int choice2;
int choice3;
// TODO Auto-generated method stub
String name, kingdom, food, environment;
double lifetime, weight;
ArrayList<Animals> animals = new ArrayList<Animals>();
animals.add(new Mammals("Cow","Mammals","Herbivorous", "Mountains", 15, 300));
animals.add(new Mammals("Bear", "Mammals", "Omnivorous", "Mountains" , 20, 400 ));
animals.add(new Mammals("Jaguar", "Mammals", "Carnivorous", "Jungle", 17, 150));
animals.add(new Birds("Flamingo", "Birds", "Omnivorous", "Jungle", 7 , 10 ));
animals.add(new Birds("Colibri", "Birds", "Herbivorous", "Jungle", 5 , 0.2 ));
animals.add(new Birds("Albatross", "Birds", "Herbivorous", "Oceans", 12, 0.4));
animals.add(new Fish("Shark","Fish","Carnivorous","Oceans",13, 250));
animals.add(new Fish("Piranha","Fish","Omnivorous", "Jungle", 4, 0.3));
animals.add(new Fish("Trout", "Fish", "Herbivorous","Oceans", 3, 0.4));
animals.add(new Reptiles("Scorpion","Reptiles","Insects", "Desert",6, 0.2));
animals.add(new Reptiles("Chameleon", "Reptiles", "Insects", "Jungle", 11, 0.4));
animals.add(new Reptiles("Turtle","Reptiles", "Omnivorous", "Oceans", 30, 50));
System.out.println("All Animals in St John Online Zoo:");
// a for loop for displaying all the animals
for (int i = 0; i < animals.size(); i++) {
System.out.println("Name: " + animals.get(i).name + "\n" +
"Kingdom: " + animals.get(i).kingdom + "\n" +
"Food: " + animals.get(i).food + "\n" +
"Environment: " + animals.get(i).environment + "\n" +
"Lifetime (years) : " + animals.get(i).lifetime + "\n" +
"Weight (kilograms) : " + animals.get(i).weight + "\n" + "\n");
}
// a switch case for displaying characteristics of an individual animal
System.out.println("For which animal do you want to see the full details: " + "\n"+
"1.Cow" + "\n" +
"2.Bear" + "\n" +
"3.Jaguar" + "\n" +
"4.Flamingo" + "\n" +
"5.Colibri" + "\n" +
"6.Albatross" + "\n" +
"7.Shark" + "\n" +
"8.Piranha" + "\n" +
"9.Trout" + "\n" +
"10.Scorpion" + "\n" +
"11.Chameleon" + "\n" +
"12.Turtle" + "\n") ;
choice = input.nextInt();
switch (choice) {
case 1:
System.out.print("Name: Cow" + "\n"+
"Kingdom: Mammals" + "\n"+
"Food: Herbivorous" + "\n"+
"Environment: Mountains" +"\n"+
"Lifetime: 15.0" + "\n"+
"Weight: 300.0" + "\n");
break;
case 2:
System.out.print("Name: Bear"+ "\n"+
"Kingdom: Mammals"+ "\n"+
"Food: Omnivorous"+"\n"+
"Environment: Mountains"+"\n"+
"Lifetime: 20.0"+"\n"+
"Weight: 400.0"+"\n");
break;
case 3:
System.out.print("Name: Jaguar"+ "\n"+
"Kingdom: Mammals"+ "\n"+
"Food: Carnivorous"+"\n"+
"Environment: Jungle"+"\n"+
"Lifetime: 17"+"\n"+
"Weight: 150"+"\n");
break;
case 4:
System.out.print("Name: Flamingo"+ "\n"+
"Kingdom: Birds"+ "\n"+
"Food: Omnivorous"+"\n"+
"Environment: Jungle"+"\n"+
"Lifetime: 7"+"\n"+
"Weight: 10"+"\n");
break;
case 5:
System.out.print("Name: Colibri"+ "\n"+
"Kingdom: Birds"+ "\n"+
"Food: Herbivorous"+"\n"+
"Environment: Jungle"+"\n"+
"Lifetime: 5"+"\n"+
"Weight: 0.2"+"\n");
break;
case 6:
System.out.print("Name: Albatross"+ "\n"+
"Kingdom: Birds"+ "\n"+
"Food: Herbivorous"+"\n"+
"Environment: Oceans"+"\n"+
"Lifetime: 12"+"\n"+
"Weight: 0.4"+"\n");
break;
case 7:
System.out.print("Name: Shark"+ "\n"+
"Kingdom: Fish"+ "\n"+
"Food: Carnivorous"+"\n"+
"Environment: Oceans"+"\n"+
"Lifetime: 13"+"\n"+
"Weight: 250"+"\n");
break;
case 8:
System.out.print("Name: Piranha"+ "\n"+
"Kingdom: Fish"+ "\n"+
"Food: Omnivorous"+"\n"+
"Environment: Jungle"+"\n"+
"Lifetime: 4"+"\n"+
"Weight: 0.3"+"\n");
break;
case 9: System.out.print("Name: Trout"+ "\n"+
"Kingdom: Fish"+ "\n"+
"Food: Herbivorous"+"\n"+
"Environment: Oceans"+"\n"+
"Lifetime: 3"+"\n"+
"Weight: 0.4"+"\n");
break;
case 10:
System.out.print("Name: Scorpion"+ "\n"+
"Kingdom: Reptiles"+ "\n"+
"Food: Insects"+"\n"+
"Environment: Desert"+"\n"+
"Lifetime: 6"+"\n"+
"Weight: 0.2"+"\n");
break;
case 11: System.out.print("Name: Chameleon"+ "\n"+
"Kingdom: Reptiles"+ "\n"+
"Food: Insects"+"\n"+
"Environment: Jungle"+"\n"+
"Lifetime: 11"+"\n"+
"Weight: 0.4"+"\n");
break;
case 12: System.out.print("Name: Turtle"+ "\n"+
"Kingdom: Reptiles"+ "\n"+
"Food: Omnivorous"+"\n"+
"Environment: Oceans"+"\n"+
"Lifetime: 30"+"\n"+
"Weight: 50"+"\n");
break;
default:
System.out.println("Please insert a number from 1 to 12" + "\n");
}
System.out.println("Choose a kingdom to see all animals of that type: " + "\n"+
"1.Mammals" + "\n"+
"2.Birds" + "\n"+
"3.Fish" + "\n"+
"4.Reptiles" + "\n");
choice2 = input.nextInt();
switch(choice2) {
case 1:
//generating an array list of animals by type
ArrayList<String> typeM = new ArrayList<String>();
System.out.println("All Mammals: " );
for(Animals a : animals) {
if(a instanceof Mammals) {
typeM.add( a.name );
}
}
for(int i=0; i<typeM.size(); i++) {
System.out.println(typeM.get(i));
}
break;
case 2:
//generating an arraylist of animals by type
ArrayList<String> typeB = new ArrayList<String>();
System.out.println("All Birds: ");
for(Animals a : animals) {
if(a instanceof Birds)
typeB.add( a.name);
}
{
for(int i=0; i<typeB.size(); i++) {
System.out.println(typeB.get(i));
}
}
break;
case 3:
//generating an arraylist of animals by type
ArrayList<String> typeF = new ArrayList<String>();
System.out.println("All Fish: " );
for(Animals a : animals) {
if(a instanceof Fish) {
typeF.add( a.name );
}
}
for(int i=0; i<typeF.size(); i++) {
System.out.println(typeF.get(i));
}
break;
case 4:
//generating an arraylist of animals by type
ArrayList<String> typeR = new ArrayList<String>();
System.out.println("All Reptiles: " );
for(Animals a : animals) {
if(a instanceof Reptiles) {
typeR.add( a.name );
}
}
for(int i=0; i<typeR.size(); i++) {
System.out.println(typeR.get(i));
}
break;
default : System.out.println("There are only four types available. Choose again!" + "\n");
}
// a for loop that display food required for all animals in the list
System.out.println("Food required for York St John Zoo animals " + "\n");
for (int i = 0; i < animals.size(); i++) {
System.out.println("Name: " + animals.get(i).name );
System.out.println("Food: " + animals.get(i).food + "\n");}
}
}
package yorkStJohnZoo;
public class Reptiles extends Animals {
public Reptiles(String n, String k, String f, String e, double l, double w) {
super(n, k, f, e, l, w);
// TODO Auto-generated constructor stub
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment