1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Jlenok [28]
2 years ago
11

Write a program that uses the Purchase class in 5.13. Set the prices to the following: Oranges: 10 for $2.99 Eggs: 12 for $1.69

Apples: 3 for $1.00 Watermelons: $4.39 each Bagels: 6 for $3.50 Set the purchased quantity to the following: 2 dozen oranges, 2 dozen eggs, 20 apples, 2 watermelons, 1 dozen bagels Display the total cost of the bill
Computers and Technology
1 answer:
Xelga [282]2 years ago
5 0

Answer:

Explanation:

The following program is written in Java. Using the program code from Purchase class in 5.13 I created each one of the fruit objects. Then I set the price for each object using the setPrice method. Then I set the number of each fruit that I intended on buying with the setNumberBought method. Finally, I called each objects getTotalCost method to get the final price of each object which was all added to the totalCost instance variable. This instance variable was printed as the total cost of the bill at the end of the program. My code HIGHLIGHTED BELOW

//Entire code is in text file attached below.

//MY CODE HERE

       DecimalFormat df = new DecimalFormat("0.00");

       oranges.setPrice(10, 2.99);

       oranges.setNumberBought(2*12);

       eggs.setPrice(12, 1.69);

       eggs.setNumberBought(2*12);

       apples.setPrice(3, 1);

       apples.setNumberBought(20);

       watermelons.setPrice(1, 4.39);

       watermelons.setNumberBought(2);

       bagels.setPrice(6, 3.50);

       bagels.setNumberBought(12);

       totalCost = oranges.getTotalCost() + eggs.getTotalCost() + apples.getTotalCost() + watermelons.getTotalCost() + bagels.getTotalCost();

       System.out.println("Total Cost: $" + df.format(totalCost));

   }

}

You might be interested in
Microsoft word's spell checker
natka813 [3]
A, will also check word usage
7 0
3 years ago
Read 2 more answers
The manufacturer doesn't need it the buyer doesn't want it the user doesn't know they're using it
Vikentia [17]
That means that the production vause a loss in supply and demand
6 0
3 years ago
Developed the first compiler and conducted work that led to the development of COBOL ?
zimovet [89]

Answer:

Grace Hopper.

Explanation:

Grace Hopper was a US Naval Rear Admiral and an American computer scientist who was born on the 9th of December, 1906 in New York city, United States of America. She worked on the first commercial computer known as universal automatic computer (UNIVAC), after the second World War II.

In 1953 at the Remington Rand, Grace Hopper invented the first high-level programming language for UNIVAC 1 by using words and expressions.

Additionally, the high-level programming language known as FLOW-MATIC that she invented in 1953 paved the way for the development of common business-oriented language (COBOL).

Hence, Grace Hopper developed the first compiler and conducted work that led to the development of COBOL.

6 0
3 years ago
Explain block diagram of. computer architure​
ozzi

Answer:

A block diagram is a diagram of a system in which the principal parts or functions are represented by blocks connected by lines that show the relationships of the blocks. They are heavily used in engineering in hardware design, electronic design, software design, and process flow diagrams.

Explanation:

In your question you asked architure but maybe it is architecture (•;

5 0
2 years ago
PLZ HELP!!!
mariarad [96]
Answer: A. Usability testing
Explanation:
Usability testing would be the correct answer because if the user interface isn't "frendly" then people won't be able to use it properly. Or if you are refering to the word friendly as looking safe, then even more so would be usability testing. Because if people don't like the fonts and styles of the user interface, they might not use it at all.
8 0
2 years ago
Other questions:
  • Which hexadecimal-type address refers to a physical networking device such as a network interface card?
    10·1 answer
  • The company database may be stored on a central database server and managed by a database adminstrator true or false
    12·1 answer
  • What is the correct html for referring to an external style sheet?
    11·1 answer
  • In the RSA system, the receiver does as follows:1. Randomly select two large prime numbers p and q, which always must bekept sec
    6·1 answer
  • How many people are in Siver, on the game Valorant?
    14·1 answer
  • When creating any digital work, what is the MOST important thing to remember?
    7·1 answer
  • What are some limitations when it comes to testing and ensuring program quality? List at
    15·1 answer
  • In Criminal justice, the type of evidence which contradicts a given theory is known as?​
    15·1 answer
  • An additional factor in how an element is rendered is that properties are passed from a parent element to its children in a proc
    15·1 answer
  • HELP ASAP
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!