1 answer

COSC 1047-Final Exam- Winter 2019 games and action figures. public interface Inventoryitem I Retu...

Question:

COSC 1047-Final Exam- Winter 2019 games and action figures. public interface Inventoryitem I Return the value of an item (qua

COSC 1047-Flhal Exdill fou work for a store that sells comics, board games and action figures. public interface Inventoryitem
COSC 1047-Final Exam- Winter 2019 games and action figures. public interface Inventoryitem I Return the value of an item (quantity on public double getItemValue () 3 hand setall price)- Set the quantity of that iten in the stoce public void setQuantitylint qty) 7Return the inventory part number. public int getFartNumber o (6 marks) Assume that there are Comic, BoardGame and ActionFigure classes already written and that all thre implement Inventoryltem. Write statements to accomplish the following a. . Create an array that stores a comic book item, a board game item and an action figure item . Assume that the constructor for each takes in a String (short description), an int (part a double (retail price). . Set the quantity of each item on hand to be something O. Using a for loop, compute (and eventually print) the total value of all items in the store. Determine which item has the lowest part number. .
COSC 1047-Flhal Exdill fou work for a store that sells comics, board games and action figures. public interface Inventoryitem 77 Return the value of an item (quantity on hand retail price) public double getItemValue O) : // Set the quantity of that item in the store public void setQuantity(int qty) // Return the inventory part number public int getPartNumber O 6 marks) Assume that there are Comic, BoardGame and ActionFigure classes already written and that all three implement Inventoryltem. Write statements to accomplish the following: Create an array that stores a comic book item, a board game item and an action figure item. Assume that the constructor for each takes in a String (short description), an int (part number), a double (retail price). Set the quantity of each item on hand to be something>O Using a for loop, compute (and eventually print) the total value of all items in the store. Determine which item has the lowest part number. . .

Answers

class Main
{
double total=0; int lowest;
Comic c[] = new Comic[2]; //array for comics
BoardGame b[] = new BoardGame[2]; //array for BoardGame
ActionFigure a[] = new ActionFigure[2]; //array for ActionFigure
  
c[0] = new Comic("Marvel",5,29.3); //initialize
c[1] = new Comic("DC",3,19.3);
  
b[0] = new BoardGame("Monopoly",25,629.3);
b[1] = new BoardGame("Business",15,529.3);
  
a[0] = new ActionFigure("Batman",6,829.3);
a[1] = new ActionFigure("Superman",12,1029.3);
  
a[0].setQuantity(12);
a[1].setQuantity(23);
b[0].setQuantity(3);
b[1].setQuantity(2);
c[0].setQuantity(123);
c[1].setQuantity(203); //initialization over
  
lowest = a[0].getPartNumber(); //initializing lowest
  
for (int i=0; i<a.size(); i++) //calculating total
total = total + a[i].getItemValue();
for (int i=0; i<b.size(); i++)
total = total + b[i].getItemValue();
for (int i=0; i<c.size(); i++)
total = total + c[i].getItemValue();
  
System.out.println("Total:\t"+total);
  
for (int i=0; i<a.size(); i++) //calculating lowest value
if(a[i].getItemValue()<lowest)
lowest = a[i].getItemValue();
for (int i=0; i<b.size(); i++)
if(b[i].getItemValue()<lowest)
lowest = b[i].getItemValue();
for (int i=0; i<c.size(); i++)
if(c[i].getItemValue()<lowest)
lowest = c[i].getItemValue();
  
}

COMMENT DOWN FOR ANY QUERIES AND,

LEAVE A THUMBS UP IF THIS ANSWER HELPS YOU.

.

Similar Solved Questions

1 answer
Please solve all the questions . i need them urgently 1. Explain the concept of an...
please solve all the questions . i need them urgently 1. Explain the concept of an initial-value problem for a differential equation (You may use examples to support your answer). 2. Find an example of a boundary value problem for a partial differential equation (you can write this in the same forma...
1 answer
Please help thank you will upvote ! The position a block with mass m=6kg is given...
Please help thank you will upvote ! The position a block with mass m=6kg is given by F =(1.2m/s) 4+15.9 m/s)t3-(3.3 m/s^)t* 2. what is magnitude of the force at t=5 sec? (disregard the gravitational force) A car moving at speed 32 m/s on a dry pavement, skids to a stop over 227 m. What is the c...
1 answer
01. If a woman starts ovulating at 13 and stops at 50. a) how many ova...
01. If a woman starts ovulating at 13 and stops at 50. a) how many ova are likely to be released from her ova b) about how many of these ova are likely to be fertilizer Q2. If mating takes place a) two days before ovulation, is fertilisation likely to occur? Explain your a y to occur? Explain your a...
1 answer
Which three planets have rings?
Which three planets have rings?...
1 answer
E8-8 Recording and Reporting Allowance for Doubtful Accounts Using the Percentage of Credit Sales and Aging...
E8-8 Recording and Reporting Allowance for Doubtful Accounts Using the Percentage of Credit Sales and Aging of Accounts Receivable Methods [LO 8-2) Innovative Tech Inc. (TI) has been using the percentage of credit sales method to estimate bad debts. During November, ITI sold services on account for ...
1 answer
1- list and describe the steps of mitosis starting with interphase and moving through the cycle?...
1- list and describe the steps of mitosis starting with interphase and moving through the cycle? 2- write the general equation for photosynthesis including balance value for input and output? 3- list six organelles find in a cell and describe each of the general functions? 4- what are the basic assu...
1 answer
How do you simplify #(45mn^3) /( 20n^7)#?
How do you simplify #(45mn^3) /( 20n^7)#?...
1 answer
What are the upper and lower control limits? Answers rounded to 3 decimal places Five data entry operators work at the...
What are the upper and lower control limits? Answers rounded to 3 decimal places Five data entry operators work at the data processing department of the Birmingham Bank. Each day for 30 days, the number of defective records in a sample of 350 records typed by these operators has been noted, as follo...
1 answer
Rank the following ions in order of decreasing bond order. [Select] AsO43– [Select] AsO2 - [Select]
Rank the following ions in order of decreasing bond order. [Select] AsO43– [Select] AsO2 - [Select]...
1 answer
Taxation Question, need a process of solution 20) Bart has the following income and expenses for...
Taxation Question, need a process of solution 20) Bart has the following income and expenses for his Schedule C 1099-MISCs received: Jack's Builders Smith's Fine Homes Murphy's Builders Total Revenue Wages Payroll taxes Payroll tax penalties License fee Supplies Cell phone Meals Inter...
1 answer
Write a CARE PLAN - on patient with cellulitis in bil lower extremities , sleep apnea,...
Write a CARE PLAN - on patient with cellulitis in bil lower extremities , sleep apnea, and lymphedema. Pt. demographics ----- Pt. is always in bed , has bil lower limb stage 4 ulcers, has a Pacemaker, syncope, and oxygen cannula.Pt. Verbal and alert&orientedx4. Pt. vitals - temp.- 96.8*F , pulse...
1 answer
QUESTION 11 a value represents the 95th percentile, this means that: 0 95% of all values...
QUESTION 11 a value represents the 95th percentile, this means that: 0 95% of all values are below this value 0 95% of all values are above this value 0 95% of the time you will observe this value O there is a 5% chance that this value is incorrect O there is a 95% chance that this value is correct ...
1 answer
Jumbuck Exploration has a current stock price of $2.00 and is expected to sell for $2.10...
Jumbuck Exploration has a current stock price of $2.00 and is expected to sell for $2.10 in one years time, immediately after it pays a dividend of $0.26. Which of the following is closest to Jumbuck Exploration's equity cost of capital? OA" 26% 0B.18% O c. 12% OD, 22% OE, 9%...
1 answer
0.5/1 pts Partial estion 6 See Figure 11-4. Which pairfs) of carbonyl compounds could do a...
0.5/1 pts Partial estion 6 See Figure 11-4. Which pairfs) of carbonyl compounds could do a condensation reaction to form the beta-diketone shown?...
1 answer
Add a detailed description of mortgage-backed securities in the context of the Global Financial Crisis, which...
add a detailed description of mortgage-backed securities in the context of the Global Financial Crisis, which includes: A detailed and specific outline of mortgage-backed securities themselves, an explanation of why they can be useful financial instruments, an explanation of the role they played in...
1 answer
Which one of the following reactions is not a good method to prepare propyl acetate? Acetic...
Which one of the following reactions is not a good method to prepare propyl acetate? Acetic acid + 1-propanol with NaOH Acetyl chloride + 1-propanol with pyridine Acetic anhydride + 1-propanol Acetic acid + 1-propanol with cat. H2SO4...
1 answer
You are the auditor of Jexel, an auto air-conditioner service and repair company, and you have...
You are the auditor of Jexel, an auto air-conditioner service and repair company, and you have decided to use the mean-per-unit method to test the existence and gross valuation of recorded accounts receivable. The client's records include 9,600 accounts with a total book value of $1,270,000. You...
1 answer
2x+y+3z=4 8. At which point(s) on the ellipsoid x2 + 4y2 + 9z2 = 36 the...
2x+y+3z=4 8. At which point(s) on the ellipsoid x2 + 4y2 + 9z2 = 36 the tangent plane is parallel to zx + y + 32 = 4. 110 points)...