SlideShare a Scribd company logo
1 of 11
//Book.java
package bookStore;
public class Book extends Product {
private String ISBN;
public Book(int pID, String bISBN, int noOfProduct) {
// TODO Auto-generated constructor stub
super(pID, noOfProduct);
this.ISBN = bISBN;
}
public String getISBN() {
return ISBN;
}
public void setISBN(String iSBN) {
ISBN = iSBN;
}
}
//CD.java
package bookStore;
public class CD extends Product {
public CD(int pID, int noOfProduct) {
super(pID, noOfProduct);
// TODO Auto-generated constructor stub
}
}
//DVD.java
package bookStore;
public class DVD extends Product {
public DVD(int pID, int noOfProduct) {
super(pID, noOfProduct);
// TODO Auto-generated constructor stub
}
}
//Member.java
package bookStore;
public class Member {
private int id;
private String firstName;
private String lastName;
private double moneySpent;
public Member(int id, String fName, String lName) {
this.id = id;
this.firstName = fName;
this.lastName = lName;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public double getMoneySpent() {
return moneySpent;
}
public void setMoneySpent(double moneySpent) {
this.moneySpent = moneySpent;
}
}
//PremiumMember.java
package bookStore;
public class PremiumMember extends Member {
private double feeMonthly;
private String paymentMethod;
private boolean feePaidOnTime;
public PremiumMember(int id, String fName, String lName) {
super(id, fName, lName);
}
public double getFeeMonthly() {
return feeMonthly;
}
public void setFeeMonthly(double feeMonthly) {
this.feeMonthly = feeMonthly;
}
public String getPaymentMethod() {
return paymentMethod;
}
public void setPaymentMethod(String paymentMethod) {
this.paymentMethod = paymentMethod;
}
public boolean isFeePaidOnTime() {
return feePaidOnTime;
}
public void setFeePaidOnTime(boolean feePaidOnTime) {
this.feePaidOnTime = feePaidOnTime;
}
}
//Product.java
package bookStore;
public class Product {
private int count;
private int productID;
public Product(int pID, int noOfProduct) {
// TODO Auto-generated constructor stub
this.productID = pID;
this.count = noOfProduct;
}
public int getProductID() {
return productID;
}
public void setProductID(int productID) {
this.productID = productID;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
//Store.java
package bookStore;
import java.util.ArrayList;
import java.util.Scanner;
public class Store {
public static ArrayList<Product> inventory = new ArrayList<Product>();
public static ArrayList<PremiumMember> members = new ArrayList<PremiumMember>();
public static Scanner sc = new Scanner(System.in);
private static void CreateInventory() {
int pID, noOfProduct;
String isBook, bISBN;
Book book;
CD cd;
DVD dvd;
System.out.println("Press Y if you want to store book in inventory");
System.out.println("Press N if you want to store CD in inventory");
System.out.println("Press NO if you want to store DVD in inventory");
isBook = sc.next();
while (true) {
System.out.println("Please enter product id");
pID = sc.nextInt();
System.out.println("Please enter number of product");
noOfProduct = sc.nextInt();
if (isBook.equalsIgnoreCase("Y")) {
System.out.println("Please enter book ISBN number");
bISBN = sc.next();
book = new Book(pID, bISBN, noOfProduct);
inventory.add(book);
} else if (isBook.equalsIgnoreCase("N")) {
cd = new CD(pID, noOfProduct);
inventory.add(cd);
} else {
dvd = new DVD(pID, noOfProduct);
inventory.add(dvd);
}
System.out.println("Press Y if you want to add another item in the inventory");
System.out.println("Press N if you do not want to add another item in the inventory");
isBook = sc.next();
if (isBook.equalsIgnoreCase("N")) {
break;
}
}
}
private static boolean findProduct(int pID) {
for (Product p : inventory) {
if (p.getProductID() == pID) {
return true;
}
}
return false;
}
private static boolean CheckInventory(int pID, int pCount) {
for (Product p : inventory) {
if (p.getProductID() == pID) {
if (p.getNoOfProducts() >= pCount) {
p.setNoOfProducts(p.getNoOfProducts() - pCount);
return true;
} else {
System.out.println("There are not enough products in the inventory.");
return false;
}
}
}
System.out.println("Product not found in inventory.");
return false;
}
private static void DistributeItem() {
int pID, pCount, id;
String premium = null, paymentMethod = null;
double fee = 0;
PremiumMember member = null;
System.out.println("Please enter product id");
pID = sc.nextInt();
if (findProduct(pID)) {
System.out.println("Please enter number of products to distribute");
pCount = sc.nextInt();
if (CheckInventory(pID, pCount)) {
System.out.println("Please enter member id");
id = sc.nextInt();
System.out.println("Please enter member first name");
String fName = sc.next();
System.out.println("Please enter member last name");
String lName = sc.next();
System.out.println("Press Y if the member is premium");
premium = sc.next();
member = new PremiumMember(id, fName, lName);
if (premium.equalsIgnoreCase("Y")) {
member.setFeeMonthly(fee);
member.setPaymentMethod(paymentMethod);
}
}
}
}
public static void main(String[] args) {
// Create array of Product class
CreateInventory();
while (true) {
// Distribute item from inventory
DistributeItem();
String check;
System.out.println("Do you want to distribute more items? Press Y for Yes or any other key for
No");
check = sc.next();
if (!check.equalsIgnoreCase("Y")) {
break;
}
}
}
}
*REVIEW THE 7 CLASSES SO THE CODE CAN RUN AND HAVE AN OUTPUT.
THERE ARE ERRORS THAT DO NOT MAKE THE CODE RUN. PLEASE HELP.
This grade is awarded for proper coding styles. This includes:
Appropriate prompts and informative output
Appropriate method, variable and object names
Proper indentation
Good commenting (explains what code is doing)
Well-organized, elegant solution
- MAKE SURE THE CODE CAN RUN!

More Related Content

Similar to --Book-java package bookStore- public class Book extends Product { (1).docx

Getting error - (Return type of out-of-line definition of 'Product--Ge.pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge.pdfGetting error - (Return type of out-of-line definition of 'Product--Ge.pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge.pdfNicholasflqStewartl
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgetsvelveeta_512
 
SinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList se.docx
SinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList    se.docxSinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList    se.docx
SinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList se.docxjennifer822
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfeyebolloptics
 
Matching Game In Java
Matching Game In JavaMatching Game In Java
Matching Game In Javacmkandemir
 
Why SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptmartinlippert
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfshaktisinhgandhinaga
 
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdfJAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdfcalderoncasto9163
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum
 
What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)Arnaud Langlade
 
Getting error - (Return type of out-of-line definition of 'Product--Ge (1).pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge (1).pdfGetting error - (Return type of out-of-line definition of 'Product--Ge (1).pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge (1).pdfNicholasflqStewartl
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdfaplolomedicalstoremr
 
Practical Event Sourcing
Practical Event SourcingPractical Event Sourcing
Practical Event SourcingMathias Verraes
 
Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specificationsrajkumari873
 
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptOBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptSaadAsim11
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design PatternsGodfrey Nolan
 
Why won't my code build and run- and what is the correct code so it bu (1).pdf
Why won't my code build and run- and what is the correct code so it bu (1).pdfWhy won't my code build and run- and what is the correct code so it bu (1).pdf
Why won't my code build and run- and what is the correct code so it bu (1).pdfumeshagarwal39
 

Similar to --Book-java package bookStore- public class Book extends Product { (1).docx (20)

Getting error - (Return type of out-of-line definition of 'Product--Ge.pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge.pdfGetting error - (Return type of out-of-line definition of 'Product--Ge.pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge.pdf
 
Getting the Most Out of jQuery Widgets
Getting the Most Out of jQuery WidgetsGetting the Most Out of jQuery Widgets
Getting the Most Out of jQuery Widgets
 
SinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList se.docx
SinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList    se.docxSinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList    se.docx
SinglyLinkedListPseudoCode.txtCLASS SinglyLinkedList se.docx
 
Write a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdfWrite a program that mimics the operations of several vending machin.pdf
Write a program that mimics the operations of several vending machin.pdf
 
Matching Game In Java
Matching Game In JavaMatching Game In Java
Matching Game In Java
 
Why SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScript
 
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdfimport java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
import java.util.Scanner;class BinaryNode{     BinaryNode left.pdf
 
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdfJAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtil
 
What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)What is the difference between a good and a bad repository? (Forum PHP 2018)
What is the difference between a good and a bad repository? (Forum PHP 2018)
 
Getting error - (Return type of out-of-line definition of 'Product--Ge (1).pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge (1).pdfGetting error - (Return type of out-of-line definition of 'Product--Ge (1).pdf
Getting error - (Return type of out-of-line definition of 'Product--Ge (1).pdf
 
@author public class Person{   String sname, .pdf
  @author   public class Person{   String sname, .pdf  @author   public class Person{   String sname, .pdf
@author public class Person{   String sname, .pdf
 
Practical Event Sourcing
Practical Event SourcingPractical Event Sourcing
Practical Event Sourcing
 
Manual tecnic sergi_subirats
Manual tecnic sergi_subiratsManual tecnic sergi_subirats
Manual tecnic sergi_subirats
 
Java2
Java2Java2
Java2
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Quest 1 define a class batsman with the following specifications
Quest  1 define a class batsman with the following specificationsQuest  1 define a class batsman with the following specifications
Quest 1 define a class batsman with the following specifications
 
OBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .pptOBJECTS IN Object Oriented Programming .ppt
OBJECTS IN Object Oriented Programming .ppt
 
Android Design Patterns
Android Design PatternsAndroid Design Patterns
Android Design Patterns
 
Why won't my code build and run- and what is the correct code so it bu (1).pdf
Why won't my code build and run- and what is the correct code so it bu (1).pdfWhy won't my code build and run- and what is the correct code so it bu (1).pdf
Why won't my code build and run- and what is the correct code so it bu (1).pdf
 

More from PiersRCoThomsonw

-Complete the following Biology I questions for section a- (attached b.docx
-Complete the following Biology I questions for section a- (attached b.docx-Complete the following Biology I questions for section a- (attached b.docx
-Complete the following Biology I questions for section a- (attached b.docxPiersRCoThomsonw
 
-Calculating Probability from Data- The table below gives details of s.docx
-Calculating Probability from Data- The table below gives details of s.docx-Calculating Probability from Data- The table below gives details of s.docx
-Calculating Probability from Data- The table below gives details of s.docxPiersRCoThomsonw
 
- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx
- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx
- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docxPiersRCoThomsonw
 
-Collenchyma -Cambium -Parenchyma -Vascular tissue system -Sclereid.docx
-Collenchyma -Cambium -Parenchyma  -Vascular tissue system  -Sclereid.docx-Collenchyma -Cambium -Parenchyma  -Vascular tissue system  -Sclereid.docx
-Collenchyma -Cambium -Parenchyma -Vascular tissue system -Sclereid.docxPiersRCoThomsonw
 
-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx
-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx
-Analyze the effects of the COVVI-19 pandemic on food (interventions).docxPiersRCoThomsonw
 
-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx
-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx
-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docxPiersRCoThomsonw
 
-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx
-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx
-1-_______________- 10- What is the amount of Siena and Kendall's reti.docxPiersRCoThomsonw
 
---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx
---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx
---HINT- Consider the case when n-3- Professor Kelp decides to write a.docxPiersRCoThomsonw
 
(2 points) What is the Boolean expression for P- Design a circuit that.docx
(2 points) What is the Boolean expression for P- Design a circuit that.docx(2 points) What is the Boolean expression for P- Design a circuit that.docx
(2 points) What is the Boolean expression for P- Design a circuit that.docxPiersRCoThomsonw
 
- Use a paragraph to reflect upon why you are interested in the chosen.docx
- Use a paragraph to reflect upon why you are interested in the chosen.docx- Use a paragraph to reflect upon why you are interested in the chosen.docx
- Use a paragraph to reflect upon why you are interested in the chosen.docxPiersRCoThomsonw
 
- With your partner- list at least two tangible resources- two intangi.docx
- With your partner- list at least two tangible resources- two intangi.docx- With your partner- list at least two tangible resources- two intangi.docx
- With your partner- list at least two tangible resources- two intangi.docxPiersRCoThomsonw
 
- List the following in order of precedence from highest precedence to.docx
- List the following in order of precedence from highest precedence to.docx- List the following in order of precedence from highest precedence to.docx
- List the following in order of precedence from highest precedence to.docxPiersRCoThomsonw
 
- Execute Summary - Overall paragraph of the the numer of devices that.docx
- Execute Summary - Overall paragraph of the the numer of devices that.docx- Execute Summary - Overall paragraph of the the numer of devices that.docx
- Execute Summary - Overall paragraph of the the numer of devices that.docxPiersRCoThomsonw
 
- Climate change is a very big deai as it affects everyone- but not al.docx
- Climate change is a very big deai as it affects everyone- but not al.docx- Climate change is a very big deai as it affects everyone- but not al.docx
- Climate change is a very big deai as it affects everyone- but not al.docxPiersRCoThomsonw
 
- Annual Demand -2-000 units - Days per year considered in average dai.docx
- Annual Demand -2-000 units - Days per year considered in average dai.docx- Annual Demand -2-000 units - Days per year considered in average dai.docx
- Annual Demand -2-000 units - Days per year considered in average dai.docxPiersRCoThomsonw
 
(Mutually exclusive projects and NPV) You have been assigned the task.docx
(Mutually exclusive projects and NPV) You have been assigned the task.docx(Mutually exclusive projects and NPV) You have been assigned the task.docx
(Mutually exclusive projects and NPV) You have been assigned the task.docxPiersRCoThomsonw
 
(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx
(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx
(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docxPiersRCoThomsonw
 
(22 pts) Derive a complexity function T(n) for the following pseudo co.docx
(22 pts) Derive a complexity function T(n) for the following pseudo co.docx(22 pts) Derive a complexity function T(n) for the following pseudo co.docx
(22 pts) Derive a complexity function T(n) for the following pseudo co.docxPiersRCoThomsonw
 
(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx
(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx
(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docxPiersRCoThomsonw
 
(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx
(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx
(4 Points) Construct to scale a diagram (likethe one used in lecture f.docxPiersRCoThomsonw
 

More from PiersRCoThomsonw (20)

-Complete the following Biology I questions for section a- (attached b.docx
-Complete the following Biology I questions for section a- (attached b.docx-Complete the following Biology I questions for section a- (attached b.docx
-Complete the following Biology I questions for section a- (attached b.docx
 
-Calculating Probability from Data- The table below gives details of s.docx
-Calculating Probability from Data- The table below gives details of s.docx-Calculating Probability from Data- The table below gives details of s.docx
-Calculating Probability from Data- The table below gives details of s.docx
 
- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx
- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx
- H2-4- (pytypes - py) Python's type (obj) function retums the type of.docx
 
-Collenchyma -Cambium -Parenchyma -Vascular tissue system -Sclereid.docx
-Collenchyma -Cambium -Parenchyma  -Vascular tissue system  -Sclereid.docx-Collenchyma -Cambium -Parenchyma  -Vascular tissue system  -Sclereid.docx
-Collenchyma -Cambium -Parenchyma -Vascular tissue system -Sclereid.docx
 
-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx
-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx
-Analyze the effects of the COVVI-19 pandemic on food (interventions).docx
 
-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx
-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx
-Analyze the effects of the COVVI-19 pandemic on (interventions) agro-.docx
 
-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx
-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx
-1-_______________- 10- What is the amount of Siena and Kendall's reti.docx
 
---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx
---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx
---HINT- Consider the case when n-3- Professor Kelp decides to write a.docx
 
(2 points) What is the Boolean expression for P- Design a circuit that.docx
(2 points) What is the Boolean expression for P- Design a circuit that.docx(2 points) What is the Boolean expression for P- Design a circuit that.docx
(2 points) What is the Boolean expression for P- Design a circuit that.docx
 
- Use a paragraph to reflect upon why you are interested in the chosen.docx
- Use a paragraph to reflect upon why you are interested in the chosen.docx- Use a paragraph to reflect upon why you are interested in the chosen.docx
- Use a paragraph to reflect upon why you are interested in the chosen.docx
 
- With your partner- list at least two tangible resources- two intangi.docx
- With your partner- list at least two tangible resources- two intangi.docx- With your partner- list at least two tangible resources- two intangi.docx
- With your partner- list at least two tangible resources- two intangi.docx
 
- List the following in order of precedence from highest precedence to.docx
- List the following in order of precedence from highest precedence to.docx- List the following in order of precedence from highest precedence to.docx
- List the following in order of precedence from highest precedence to.docx
 
- Execute Summary - Overall paragraph of the the numer of devices that.docx
- Execute Summary - Overall paragraph of the the numer of devices that.docx- Execute Summary - Overall paragraph of the the numer of devices that.docx
- Execute Summary - Overall paragraph of the the numer of devices that.docx
 
- Climate change is a very big deai as it affects everyone- but not al.docx
- Climate change is a very big deai as it affects everyone- but not al.docx- Climate change is a very big deai as it affects everyone- but not al.docx
- Climate change is a very big deai as it affects everyone- but not al.docx
 
- Annual Demand -2-000 units - Days per year considered in average dai.docx
- Annual Demand -2-000 units - Days per year considered in average dai.docx- Annual Demand -2-000 units - Days per year considered in average dai.docx
- Annual Demand -2-000 units - Days per year considered in average dai.docx
 
(Mutually exclusive projects and NPV) You have been assigned the task.docx
(Mutually exclusive projects and NPV) You have been assigned the task.docx(Mutually exclusive projects and NPV) You have been assigned the task.docx
(Mutually exclusive projects and NPV) You have been assigned the task.docx
 
(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx
(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx
(1) Nonsidering aboue ER dingram- (a) Poovide the relational scbema (b.docx
 
(22 pts) Derive a complexity function T(n) for the following pseudo co.docx
(22 pts) Derive a complexity function T(n) for the following pseudo co.docx(22 pts) Derive a complexity function T(n) for the following pseudo co.docx
(22 pts) Derive a complexity function T(n) for the following pseudo co.docx
 
(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx
(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx
(1 point) Construct a simple graph with vertices H-I-J-K whose degrees.docx
 
(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx
(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx
(4 Points) Construct to scale a diagram (likethe one used in lecture f.docx
 

Recently uploaded

General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
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
 
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
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
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
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
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
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactisticshameyhk98
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
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
 
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
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .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...
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
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_...
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 

--Book-java package bookStore- public class Book extends Product { (1).docx

  • 1. //Book.java package bookStore; public class Book extends Product { private String ISBN; public Book(int pID, String bISBN, int noOfProduct) { // TODO Auto-generated constructor stub super(pID, noOfProduct); this.ISBN = bISBN; } public String getISBN() { return ISBN; } public void setISBN(String iSBN) { ISBN = iSBN; } } //CD.java package bookStore; public class CD extends Product { public CD(int pID, int noOfProduct) { super(pID, noOfProduct); // TODO Auto-generated constructor stub }
  • 2. } //DVD.java package bookStore; public class DVD extends Product { public DVD(int pID, int noOfProduct) { super(pID, noOfProduct); // TODO Auto-generated constructor stub } } //Member.java package bookStore; public class Member { private int id; private String firstName; private String lastName; private double moneySpent; public Member(int id, String fName, String lName) { this.id = id; this.firstName = fName; this.lastName = lName; } public int getId() { return id;
  • 3. } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public double getMoneySpent() { return moneySpent; } public void setMoneySpent(double moneySpent) { this.moneySpent = moneySpent; } }
  • 4. //PremiumMember.java package bookStore; public class PremiumMember extends Member { private double feeMonthly; private String paymentMethod; private boolean feePaidOnTime; public PremiumMember(int id, String fName, String lName) { super(id, fName, lName); } public double getFeeMonthly() { return feeMonthly; } public void setFeeMonthly(double feeMonthly) { this.feeMonthly = feeMonthly; } public String getPaymentMethod() { return paymentMethod; } public void setPaymentMethod(String paymentMethod) { this.paymentMethod = paymentMethod; } public boolean isFeePaidOnTime() { return feePaidOnTime;
  • 5. } public void setFeePaidOnTime(boolean feePaidOnTime) { this.feePaidOnTime = feePaidOnTime; } } //Product.java package bookStore; public class Product { private int count; private int productID; public Product(int pID, int noOfProduct) { // TODO Auto-generated constructor stub this.productID = pID; this.count = noOfProduct; } public int getProductID() { return productID; } public void setProductID(int productID) { this.productID = productID; } public int getCount() { return count;
  • 6. } public void setCount(int count) { this.count = count; } } //Store.java package bookStore; import java.util.ArrayList; import java.util.Scanner; public class Store { public static ArrayList<Product> inventory = new ArrayList<Product>(); public static ArrayList<PremiumMember> members = new ArrayList<PremiumMember>(); public static Scanner sc = new Scanner(System.in); private static void CreateInventory() { int pID, noOfProduct; String isBook, bISBN; Book book; CD cd; DVD dvd; System.out.println("Press Y if you want to store book in inventory"); System.out.println("Press N if you want to store CD in inventory"); System.out.println("Press NO if you want to store DVD in inventory"); isBook = sc.next();
  • 7. while (true) { System.out.println("Please enter product id"); pID = sc.nextInt(); System.out.println("Please enter number of product"); noOfProduct = sc.nextInt(); if (isBook.equalsIgnoreCase("Y")) { System.out.println("Please enter book ISBN number"); bISBN = sc.next(); book = new Book(pID, bISBN, noOfProduct); inventory.add(book); } else if (isBook.equalsIgnoreCase("N")) { cd = new CD(pID, noOfProduct); inventory.add(cd); } else { dvd = new DVD(pID, noOfProduct); inventory.add(dvd); } System.out.println("Press Y if you want to add another item in the inventory"); System.out.println("Press N if you do not want to add another item in the inventory"); isBook = sc.next(); if (isBook.equalsIgnoreCase("N")) { break; }
  • 8. } } private static boolean findProduct(int pID) { for (Product p : inventory) { if (p.getProductID() == pID) { return true; } } return false; } private static boolean CheckInventory(int pID, int pCount) { for (Product p : inventory) { if (p.getProductID() == pID) { if (p.getNoOfProducts() >= pCount) { p.setNoOfProducts(p.getNoOfProducts() - pCount); return true; } else { System.out.println("There are not enough products in the inventory."); return false; } } } System.out.println("Product not found in inventory.");
  • 9. return false; } private static void DistributeItem() { int pID, pCount, id; String premium = null, paymentMethod = null; double fee = 0; PremiumMember member = null; System.out.println("Please enter product id"); pID = sc.nextInt(); if (findProduct(pID)) { System.out.println("Please enter number of products to distribute"); pCount = sc.nextInt(); if (CheckInventory(pID, pCount)) { System.out.println("Please enter member id"); id = sc.nextInt(); System.out.println("Please enter member first name"); String fName = sc.next(); System.out.println("Please enter member last name"); String lName = sc.next(); System.out.println("Press Y if the member is premium"); premium = sc.next(); member = new PremiumMember(id, fName, lName); if (premium.equalsIgnoreCase("Y")) {
  • 10. member.setFeeMonthly(fee); member.setPaymentMethod(paymentMethod); } } } } public static void main(String[] args) { // Create array of Product class CreateInventory(); while (true) { // Distribute item from inventory DistributeItem(); String check; System.out.println("Do you want to distribute more items? Press Y for Yes or any other key for No"); check = sc.next(); if (!check.equalsIgnoreCase("Y")) { break; } } } } *REVIEW THE 7 CLASSES SO THE CODE CAN RUN AND HAVE AN OUTPUT. THERE ARE ERRORS THAT DO NOT MAKE THE CODE RUN. PLEASE HELP.
  • 11. This grade is awarded for proper coding styles. This includes: Appropriate prompts and informative output Appropriate method, variable and object names Proper indentation Good commenting (explains what code is doing) Well-organized, elegant solution - MAKE SURE THE CODE CAN RUN!