SlideShare a Scribd company logo
1 of 6
Download to read offline
Please write a java code for this Codes are posted below for editing.
***Main Class****
public class Main {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
PetStore ps = new PetStore("Insert Petstore name here");
System.out.println("**** Welcome to " + ps.getStoreName() + "****");
while (true) {
System.out.println("Please select from one of the following menu otions");
System.out.println("t1. Buy a new pet");
System.out.println("t2. Register a new member");
System.out.println("t3. Start adoption drive (add new pets)");
System.out.println("t4. Check current inventory");
System.out.println("t5. Register new pet to Owner profile");
System.out.println("t6. Exit");
int choice1 = scnr.nextInt();
switch (choice1) {
case 1:
System.out.println("What type of pet are you here to purchase?");
System.out.println("t1. Dogs");
System.out.println("t2. Cats");
System.out.println("t3. Exotic Pets");
// Add/Change code here
break;
case 2:
break;
case 3:
break;
case 4:
break;
case 5:
break;
case 6:
System.out.println("Thanks for visiting!");
return;
default:
System.out.println("Invalid choice, try again.");
}
}
}
}
****Pet Store*****
import java.util.*;
public class PetStore {
private String storeName;
private ArrayList<Dog> availableDogs = new ArrayList();
private ArrayList<Cat> availableCats = new ArrayList();
private ArrayList<ExoticPet> availableExoticPets = new ArrayList();
private ArrayList<Member> memberList = new ArrayList();
private ArrayList<PremiumMember> premiumMemberList = new ArrayList();
private static int nextPetID = 1;
public PetStore(String storeName) {
this.storeName = storeName;
Dog dog1 = new Dog("Kaylee", "German Shepherd", "Female", 12, 85, getNextPetID(), 500);
Dog dog2 = new Dog("Poe", "Corgi", "Male", 3, 35, getNextPetID(), 450);
Cat cat1 = new Cat("Karma", "Orange Tabby", "Female", 6, 15,getNextPetID(), 200);
Cat cat2 = new Cat("Kit", "Maine Coon", "Male",6, 18, getNextPetID(), 150);
ExoticPet ep1 = new ExoticPet("Pancake", "Bearded Dragon", "Male", 6, 0.8, getNextPetID(), 75);
ExoticPet ep2 = new ExoticPet("Noodle", "Ball Python", "Male", 4, 2, getNextPetID(), 95);
availableDogs.add(dog1);
availableDogs.add(dog2);
availableCats.add(cat1);
availableCats.add(cat2);
availableExoticPets.add(ep1);
availableExoticPets.add(ep2);
Member member1 = new Member("Jo", 234, true);
member1.addCat(new Cat("Valjean", "White tabby", "Male",1,10,0,0));
PremiumMember member2 = new PremiumMember("Sage", 567, false, true);
member2.addExoticPet(new ExoticPet("Smaug", "Bearded Dragon", "Male", 5, 1, 0,0));
}
public static int getNextPetID() {
nextPetID++;
return nextPetID-1;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public ArrayList<Dog> getAvailableDogs() {
return availableDogs;
}
public void setAvailableDogs(ArrayList<Dog> availableDogs) {
this.availableDogs = availableDogs;
}
public ArrayList<Cat> getAvailableCats() {
return availableCats;
}
public void setAvailableCats(ArrayList<Cat> availableCats) {
this.availableCats = availableCats;
}
public ArrayList<ExoticPet> getAvailableExoticPets() {
return availableExoticPets;
}
public void setAvailableExoticPets(ArrayList<ExoticPet> availableExoticPets) {
this.availableExoticPets = availableExoticPets;
}
public ArrayList<Member> getMemberList() {
return memberList;
}
public void setMemberList(ArrayList<Member> memberList) {
this.memberList = memberList;
}
public ArrayList<PremiumMember> getPremiumMemberList() {
return premiumMemberList;
}
public void setPremiumMemberList(ArrayList<PremiumMember> premiumMemberList) {
this.premiumMemberList = premiumMemberList;
}
}
****Dog***
public class Dog {
private String name;
private String breed;
private String sex;
private int age;
private double weight;
private int ID;
private double price;
public Dog(String name, String breed, String sex, int age, double weight, int ID, double price) {
this.name = name;
this.breed = breed;
this.sex = sex;
this.age = age;
this.weight = weight;
this.ID = ID;
this.price = price;
}
public int getID() {
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
***Cat****
public class Cat {
private String name;
private String breed;
private String sex;
private int age;
private double weight;
private int ID;
private double price;
public Cat(String name, String breed, String sex, int age, double weight, int ID, double price) {
this.name = name;
this.breed = breed;
this.sex = sex;
this.age = age;
this.weight = weight;
this.ID = ID;
this.price = price;
}
public int getID() {
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
***Exotic Pets****
public class ExoticPet {
private String name;
private String species;
private String sex;
private int age;
private double weight;
private int ID;
private double price;
public ExoticPet(String name, String species, String sex, int age, double weight, int ID, double
price) {
this.name = name;
this.species = species;
this.sex = sex;
this.age = age;
this.weight = weight;
this.ID = ID;
this.price = price;
}
public int getID() {
return ID;
}
public void setID(int ID) {
this.ID = ID;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
Part A - Inheritance, Abstraction and Interfaces (10 points) In this part we want to introduce
inheritance and abstraction into our system. Update this design to utilize inheritance when
representing the different pets the store sells. At a minimum your design should incorporate an
abstract class that is sub-classed into the three different pets available for purchasing - dogs, cats,
and exotic pets. This class must be an abstract class that implements the Comparable interface.
When comparing pets we want that to be either based on the price of the pet or the number of
pets of that type in stock. Choose one of those attributes and implement the compareTo method to
work based on that field. Part B - More Interfaces ( 10 points) In this part you want to update your
PetStore class to implement the following interface: PetStoreSpecification Notice that this interface
has only two methods: adoptionDrive(ArrayList<Object>, double) and inventoryValue(). The Object
class here refers to the parent class for Dog, Cat and ExoticPet. We expect one parent class for
the three pet types but you might choose a different class inheritance hierarchy make sure to note
that clearly with your submission. You might decide to have a separate inventory management
class that might be a better place to implement this interface. You are encouraged to discuss your
design with the instructional team for feedback on your project design. Keep in mind that with
computational problem solving and design there are many ways of achieving a solution. Explore
and have fun with it!Part C - Changing the Test Harness (6 points) Update the Main class to
include menu options to test the functionality added in Parts A (Comparing products) and B
(restock a product and display inventory total). Keep in mind here that you can add helper
methods to your class to make the code cleaner and easier to debug. Part D - Coding Style and
Documentation (4 points) This grade is awarded for proper coding styles. This includes: -
Appropriate prompts and informative output - Appropriate method, variable and object names -
Proper indentation - Proper java documentation - Good commenting (explains what code is doing)
- Well-organized, elegant solution

More Related Content

Similar to Please write a java code for this Codes are posted below for.pdf

Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIjagriti srivastava
 
In this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdfIn this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdffathimaoptical
 
object oriented programming java lectures
object oriented programming java lecturesobject oriented programming java lectures
object oriented programming java lecturesMSohaib24
 
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfHello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfflashfashioncasualwe
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdfakkhan101
 
Question 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxQuestion 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxamrit47
 
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docxI received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docxwalthamcoretta
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfrajeshjangid1865
 
Using-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUsing-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUadAccount
 
Grails GORM - You Know SQL. You Know Queries. Here's GORM.
Grails GORM - You Know SQL. You Know Queries. Here's GORM.Grails GORM - You Know SQL. You Know Queries. Here's GORM.
Grails GORM - You Know SQL. You Know Queries. Here's GORM.Ted Vinke
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdfanithareadymade
 
About java
About javaAbout java
About javaJay Xu
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldBTI360
 
Java Polymorphism Part 2
Java Polymorphism Part 2Java Polymorphism Part 2
Java Polymorphism Part 2AathikaJava
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfravikapoorindia
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummiesknutmork
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iiiNiraj Bharambe
 
131 Lab slides (all in one)
131 Lab slides (all in one)131 Lab slides (all in one)
131 Lab slides (all in one)Tak Lee
 

Similar to Please write a java code for this Codes are posted below for.pdf (20)

Basic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time APIBasic java, java collection Framework and Date Time API
Basic java, java collection Framework and Date Time API
 
In this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdfIn this project you will define some interfaces, abstract classes, a.pdf
In this project you will define some interfaces, abstract classes, a.pdf
 
object oriented programming java lectures
object oriented programming java lecturesobject oriented programming java lectures
object oriented programming java lectures
 
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfHello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
Question 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docxQuestion 1 1 pts Skip to question text.As part of a bank account.docx
Question 1 1 pts Skip to question text.As part of a bank account.docx
 
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docxI received answers to 2 App requests and paid. The JAVA Apps are not.docx
I received answers to 2 App requests and paid. The JAVA Apps are not.docx
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
 
Java2
Java2Java2
Java2
 
Using-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptxUsing-Python-Libraries.9485146.powerpoint.pptx
Using-Python-Libraries.9485146.powerpoint.pptx
 
Grails GORM - You Know SQL. You Know Queries. Here's GORM.
Grails GORM - You Know SQL. You Know Queries. Here's GORM.Grails GORM - You Know SQL. You Know Queries. Here's GORM.
Grails GORM - You Know SQL. You Know Queries. Here's GORM.
 
We will be making 4 classes Main - for testing the code Hi.pdf
 We will be making 4 classes Main - for testing the code Hi.pdf We will be making 4 classes Main - for testing the code Hi.pdf
We will be making 4 classes Main - for testing the code Hi.pdf
 
nested_Object as Parameter & Recursion_Later_commamd.pptx
nested_Object as Parameter  & Recursion_Later_commamd.pptxnested_Object as Parameter  & Recursion_Later_commamd.pptx
nested_Object as Parameter & Recursion_Later_commamd.pptx
 
About java
About javaAbout java
About java
 
Scala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 WorldScala vs Java 8 in a Java 8 World
Scala vs Java 8 in a Java 8 World
 
Java Polymorphism Part 2
Java Polymorphism Part 2Java Polymorphism Part 2
Java Polymorphism Part 2
 
ReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdfReversePoem.java ---------------------------------- public cl.pdf
ReversePoem.java ---------------------------------- public cl.pdf
 
Java Generics for Dummies
Java Generics for DummiesJava Generics for Dummies
Java Generics for Dummies
 
Core java pract_sem iii
Core java pract_sem iiiCore java pract_sem iii
Core java pract_sem iii
 
131 Lab slides (all in one)
131 Lab slides (all in one)131 Lab slides (all in one)
131 Lab slides (all in one)
 

More from shreedattaagenciees2

Pls provide details steps as reference much appreciated Do.pdf
Pls provide details steps as reference much appreciated Do.pdfPls provide details steps as reference much appreciated Do.pdf
Pls provide details steps as reference much appreciated Do.pdfshreedattaagenciees2
 
Plz I need your Help With these Question on page 1 2 3 As.pdf
Plz I need your Help With these Question on page 1 2 3  As.pdfPlz I need your Help With these Question on page 1 2 3  As.pdf
Plz I need your Help With these Question on page 1 2 3 As.pdfshreedattaagenciees2
 
Pleases do not copy and paste explain in your own words E.pdf
Pleases do not copy and paste explain in your own words  E.pdfPleases do not copy and paste explain in your own words  E.pdf
Pleases do not copy and paste explain in your own words E.pdfshreedattaagenciees2
 
Popovich industries stock is valued et 1300 a share The fi.pdf
Popovich industries stock is valued et 1300 a share The fi.pdfPopovich industries stock is valued et 1300 a share The fi.pdf
Popovich industries stock is valued et 1300 a share The fi.pdfshreedattaagenciees2
 
plz and thank u 13 From a Keynesian point of view which i.pdf
plz and thank u 13 From a Keynesian point of view which i.pdfplz and thank u 13 From a Keynesian point of view which i.pdf
plz and thank u 13 From a Keynesian point of view which i.pdfshreedattaagenciees2
 
Plot the image of the Nyquist contour when k 1 and Gs .pdf
Plot the image of the Nyquist contour when k  1 and Gs  .pdfPlot the image of the Nyquist contour when k  1 and Gs  .pdf
Plot the image of the Nyquist contour when k 1 and Gs .pdfshreedattaagenciees2
 
Popovich Industries stock is valued at 1000 a share The f.pdf
Popovich Industries stock is valued at 1000 a share The f.pdfPopovich Industries stock is valued at 1000 a share The f.pdf
Popovich Industries stock is valued at 1000 a share The f.pdfshreedattaagenciees2
 
Please write new code 1 A Java program contains various pa.pdf
Please write new code 1 A Java program contains various pa.pdfPlease write new code 1 A Java program contains various pa.pdf
Please write new code 1 A Java program contains various pa.pdfshreedattaagenciees2
 
Please write the name of movie also link of vdeo SYST15892 .pdf
Please write the name of movie also link of vdeo SYST15892 .pdfPlease write the name of movie also link of vdeo SYST15892 .pdf
Please write the name of movie also link of vdeo SYST15892 .pdfshreedattaagenciees2
 
Pope Leo XIII distinguishes the just ownership from the just.pdf
Pope Leo XIII distinguishes the just ownership from the just.pdfPope Leo XIII distinguishes the just ownership from the just.pdf
Pope Leo XIII distinguishes the just ownership from the just.pdfshreedattaagenciees2
 
pls create aws from the following Implement the infrastruct.pdf
pls create aws from the following Implement the infrastruct.pdfpls create aws from the following Implement the infrastruct.pdf
pls create aws from the following Implement the infrastruct.pdfshreedattaagenciees2
 
Please write on the following 5 points below on how they aff.pdf
Please write on the following 5 points below on how they aff.pdfPlease write on the following 5 points below on how they aff.pdf
Please write on the following 5 points below on how they aff.pdfshreedattaagenciees2
 
pls help me with Resource and Capability Analysis of CHIPOTL.pdf
pls help me with Resource and Capability Analysis of CHIPOTL.pdfpls help me with Resource and Capability Analysis of CHIPOTL.pdf
pls help me with Resource and Capability Analysis of CHIPOTL.pdfshreedattaagenciees2
 
Political pundits have been all over the news stating that t.pdf
Political pundits have been all over the news stating that t.pdfPolitical pundits have been all over the news stating that t.pdf
Political pundits have been all over the news stating that t.pdfshreedattaagenciees2
 
Poliomyelitis What virus causes polio How is the virus tran.pdf
Poliomyelitis What virus causes polio How is the virus tran.pdfPoliomyelitis What virus causes polio How is the virus tran.pdf
Poliomyelitis What virus causes polio How is the virus tran.pdfshreedattaagenciees2
 
Points BRECMBC9 19II002 Table 194 to calculate the bull.pdf
Points BRECMBC9 19II002 Table 194 to calculate the bull.pdfPoints BRECMBC9 19II002 Table 194 to calculate the bull.pdf
Points BRECMBC9 19II002 Table 194 to calculate the bull.pdfshreedattaagenciees2
 
points based on a users location for all modes of public tr.pdf
points based on a users location for all modes of public tr.pdfpoints based on a users location for all modes of public tr.pdf
points based on a users location for all modes of public tr.pdfshreedattaagenciees2
 
Por qu las LLC a menudo tienen problemas para obtener fond.pdf
Por qu las LLC a menudo tienen problemas para obtener fond.pdfPor qu las LLC a menudo tienen problemas para obtener fond.pdf
Por qu las LLC a menudo tienen problemas para obtener fond.pdfshreedattaagenciees2
 
Poelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdf
Poelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdfPoelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdf
Poelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdfshreedattaagenciees2
 
Pregunta 11 Responda todas las afirmaciones mencionadas a co.pdf
Pregunta 11 Responda todas las afirmaciones mencionadas a co.pdfPregunta 11 Responda todas las afirmaciones mencionadas a co.pdf
Pregunta 11 Responda todas las afirmaciones mencionadas a co.pdfshreedattaagenciees2
 

More from shreedattaagenciees2 (20)

Pls provide details steps as reference much appreciated Do.pdf
Pls provide details steps as reference much appreciated Do.pdfPls provide details steps as reference much appreciated Do.pdf
Pls provide details steps as reference much appreciated Do.pdf
 
Plz I need your Help With these Question on page 1 2 3 As.pdf
Plz I need your Help With these Question on page 1 2 3  As.pdfPlz I need your Help With these Question on page 1 2 3  As.pdf
Plz I need your Help With these Question on page 1 2 3 As.pdf
 
Pleases do not copy and paste explain in your own words E.pdf
Pleases do not copy and paste explain in your own words  E.pdfPleases do not copy and paste explain in your own words  E.pdf
Pleases do not copy and paste explain in your own words E.pdf
 
Popovich industries stock is valued et 1300 a share The fi.pdf
Popovich industries stock is valued et 1300 a share The fi.pdfPopovich industries stock is valued et 1300 a share The fi.pdf
Popovich industries stock is valued et 1300 a share The fi.pdf
 
plz and thank u 13 From a Keynesian point of view which i.pdf
plz and thank u 13 From a Keynesian point of view which i.pdfplz and thank u 13 From a Keynesian point of view which i.pdf
plz and thank u 13 From a Keynesian point of view which i.pdf
 
Plot the image of the Nyquist contour when k 1 and Gs .pdf
Plot the image of the Nyquist contour when k  1 and Gs  .pdfPlot the image of the Nyquist contour when k  1 and Gs  .pdf
Plot the image of the Nyquist contour when k 1 and Gs .pdf
 
Popovich Industries stock is valued at 1000 a share The f.pdf
Popovich Industries stock is valued at 1000 a share The f.pdfPopovich Industries stock is valued at 1000 a share The f.pdf
Popovich Industries stock is valued at 1000 a share The f.pdf
 
Please write new code 1 A Java program contains various pa.pdf
Please write new code 1 A Java program contains various pa.pdfPlease write new code 1 A Java program contains various pa.pdf
Please write new code 1 A Java program contains various pa.pdf
 
Please write the name of movie also link of vdeo SYST15892 .pdf
Please write the name of movie also link of vdeo SYST15892 .pdfPlease write the name of movie also link of vdeo SYST15892 .pdf
Please write the name of movie also link of vdeo SYST15892 .pdf
 
Pope Leo XIII distinguishes the just ownership from the just.pdf
Pope Leo XIII distinguishes the just ownership from the just.pdfPope Leo XIII distinguishes the just ownership from the just.pdf
Pope Leo XIII distinguishes the just ownership from the just.pdf
 
pls create aws from the following Implement the infrastruct.pdf
pls create aws from the following Implement the infrastruct.pdfpls create aws from the following Implement the infrastruct.pdf
pls create aws from the following Implement the infrastruct.pdf
 
Please write on the following 5 points below on how they aff.pdf
Please write on the following 5 points below on how they aff.pdfPlease write on the following 5 points below on how they aff.pdf
Please write on the following 5 points below on how they aff.pdf
 
pls help me with Resource and Capability Analysis of CHIPOTL.pdf
pls help me with Resource and Capability Analysis of CHIPOTL.pdfpls help me with Resource and Capability Analysis of CHIPOTL.pdf
pls help me with Resource and Capability Analysis of CHIPOTL.pdf
 
Political pundits have been all over the news stating that t.pdf
Political pundits have been all over the news stating that t.pdfPolitical pundits have been all over the news stating that t.pdf
Political pundits have been all over the news stating that t.pdf
 
Poliomyelitis What virus causes polio How is the virus tran.pdf
Poliomyelitis What virus causes polio How is the virus tran.pdfPoliomyelitis What virus causes polio How is the virus tran.pdf
Poliomyelitis What virus causes polio How is the virus tran.pdf
 
Points BRECMBC9 19II002 Table 194 to calculate the bull.pdf
Points BRECMBC9 19II002 Table 194 to calculate the bull.pdfPoints BRECMBC9 19II002 Table 194 to calculate the bull.pdf
Points BRECMBC9 19II002 Table 194 to calculate the bull.pdf
 
points based on a users location for all modes of public tr.pdf
points based on a users location for all modes of public tr.pdfpoints based on a users location for all modes of public tr.pdf
points based on a users location for all modes of public tr.pdf
 
Por qu las LLC a menudo tienen problemas para obtener fond.pdf
Por qu las LLC a menudo tienen problemas para obtener fond.pdfPor qu las LLC a menudo tienen problemas para obtener fond.pdf
Por qu las LLC a menudo tienen problemas para obtener fond.pdf
 
Poelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdf
Poelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdfPoelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdf
Poelien solving Gownhment Eond Tyar tare 2ipentiate Coipor.pdf
 
Pregunta 11 Responda todas las afirmaciones mencionadas a co.pdf
Pregunta 11 Responda todas las afirmaciones mencionadas a co.pdfPregunta 11 Responda todas las afirmaciones mencionadas a co.pdf
Pregunta 11 Responda todas las afirmaciones mencionadas a co.pdf
 

Recently uploaded

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...EADTU
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxJisc
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Celine George
 

Recently uploaded (20)

Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 

Please write a java code for this Codes are posted below for.pdf

  • 1. Please write a java code for this Codes are posted below for editing. ***Main Class**** public class Main { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); PetStore ps = new PetStore("Insert Petstore name here"); System.out.println("**** Welcome to " + ps.getStoreName() + "****"); while (true) { System.out.println("Please select from one of the following menu otions"); System.out.println("t1. Buy a new pet"); System.out.println("t2. Register a new member"); System.out.println("t3. Start adoption drive (add new pets)"); System.out.println("t4. Check current inventory"); System.out.println("t5. Register new pet to Owner profile"); System.out.println("t6. Exit"); int choice1 = scnr.nextInt(); switch (choice1) { case 1: System.out.println("What type of pet are you here to purchase?"); System.out.println("t1. Dogs"); System.out.println("t2. Cats"); System.out.println("t3. Exotic Pets"); // Add/Change code here break; case 2: break; case 3: break; case 4: break; case 5: break; case 6: System.out.println("Thanks for visiting!"); return; default:
  • 2. System.out.println("Invalid choice, try again."); } } } } ****Pet Store***** import java.util.*; public class PetStore { private String storeName; private ArrayList<Dog> availableDogs = new ArrayList(); private ArrayList<Cat> availableCats = new ArrayList(); private ArrayList<ExoticPet> availableExoticPets = new ArrayList(); private ArrayList<Member> memberList = new ArrayList(); private ArrayList<PremiumMember> premiumMemberList = new ArrayList(); private static int nextPetID = 1; public PetStore(String storeName) { this.storeName = storeName; Dog dog1 = new Dog("Kaylee", "German Shepherd", "Female", 12, 85, getNextPetID(), 500); Dog dog2 = new Dog("Poe", "Corgi", "Male", 3, 35, getNextPetID(), 450); Cat cat1 = new Cat("Karma", "Orange Tabby", "Female", 6, 15,getNextPetID(), 200); Cat cat2 = new Cat("Kit", "Maine Coon", "Male",6, 18, getNextPetID(), 150); ExoticPet ep1 = new ExoticPet("Pancake", "Bearded Dragon", "Male", 6, 0.8, getNextPetID(), 75); ExoticPet ep2 = new ExoticPet("Noodle", "Ball Python", "Male", 4, 2, getNextPetID(), 95); availableDogs.add(dog1); availableDogs.add(dog2); availableCats.add(cat1); availableCats.add(cat2); availableExoticPets.add(ep1); availableExoticPets.add(ep2); Member member1 = new Member("Jo", 234, true); member1.addCat(new Cat("Valjean", "White tabby", "Male",1,10,0,0)); PremiumMember member2 = new PremiumMember("Sage", 567, false, true); member2.addExoticPet(new ExoticPet("Smaug", "Bearded Dragon", "Male", 5, 1, 0,0)); } public static int getNextPetID() {
  • 3. nextPetID++; return nextPetID-1; } public String getStoreName() { return storeName; } public void setStoreName(String storeName) { this.storeName = storeName; } public ArrayList<Dog> getAvailableDogs() { return availableDogs; } public void setAvailableDogs(ArrayList<Dog> availableDogs) { this.availableDogs = availableDogs; } public ArrayList<Cat> getAvailableCats() { return availableCats; } public void setAvailableCats(ArrayList<Cat> availableCats) { this.availableCats = availableCats; } public ArrayList<ExoticPet> getAvailableExoticPets() { return availableExoticPets; } public void setAvailableExoticPets(ArrayList<ExoticPet> availableExoticPets) { this.availableExoticPets = availableExoticPets; } public ArrayList<Member> getMemberList() { return memberList; } public void setMemberList(ArrayList<Member> memberList) { this.memberList = memberList; } public ArrayList<PremiumMember> getPremiumMemberList() { return premiumMemberList; } public void setPremiumMemberList(ArrayList<PremiumMember> premiumMemberList) { this.premiumMemberList = premiumMemberList; } } ****Dog***
  • 4. public class Dog { private String name; private String breed; private String sex; private int age; private double weight; private int ID; private double price; public Dog(String name, String breed, String sex, int age, double weight, int ID, double price) { this.name = name; this.breed = breed; this.sex = sex; this.age = age; this.weight = weight; this.ID = ID; this.price = price; } public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public String getName() { return name; } public void setName(String name) { this.name = name; } ***Cat**** public class Cat { private String name;
  • 5. private String breed; private String sex; private int age; private double weight; private int ID; private double price; public Cat(String name, String breed, String sex, int age, double weight, int ID, double price) { this.name = name; this.breed = breed; this.sex = sex; this.age = age; this.weight = weight; this.ID = ID; this.price = price; } public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } ***Exotic Pets**** public class ExoticPet { private String name; private String species; private String sex; private int age; private double weight; private int ID; private double price; public ExoticPet(String name, String species, String sex, int age, double weight, int ID, double price) { this.name = name; this.species = species;
  • 6. this.sex = sex; this.age = age; this.weight = weight; this.ID = ID; this.price = price; } public int getID() { return ID; } public void setID(int ID) { this.ID = ID; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } Part A - Inheritance, Abstraction and Interfaces (10 points) In this part we want to introduce inheritance and abstraction into our system. Update this design to utilize inheritance when representing the different pets the store sells. At a minimum your design should incorporate an abstract class that is sub-classed into the three different pets available for purchasing - dogs, cats, and exotic pets. This class must be an abstract class that implements the Comparable interface. When comparing pets we want that to be either based on the price of the pet or the number of pets of that type in stock. Choose one of those attributes and implement the compareTo method to work based on that field. Part B - More Interfaces ( 10 points) In this part you want to update your PetStore class to implement the following interface: PetStoreSpecification Notice that this interface has only two methods: adoptionDrive(ArrayList<Object>, double) and inventoryValue(). The Object class here refers to the parent class for Dog, Cat and ExoticPet. We expect one parent class for the three pet types but you might choose a different class inheritance hierarchy make sure to note that clearly with your submission. You might decide to have a separate inventory management class that might be a better place to implement this interface. You are encouraged to discuss your design with the instructional team for feedback on your project design. Keep in mind that with computational problem solving and design there are many ways of achieving a solution. Explore and have fun with it!Part C - Changing the Test Harness (6 points) Update the Main class to include menu options to test the functionality added in Parts A (Comparing products) and B (restock a product and display inventory total). Keep in mind here that you can add helper methods to your class to make the code cleaner and easier to debug. Part D - Coding Style and Documentation (4 points) This grade is awarded for proper coding styles. This includes: - Appropriate prompts and informative output - Appropriate method, variable and object names - Proper indentation - Proper java documentation - Good commenting (explains what code is doing) - Well-organized, elegant solution