Consider the following code: Cash Register register = new Cash Register(); register.record Purchase(19.93); register. receive Payment (20,
Question:
Consider the following code:
Transcribed Image Text:
Cash Register register = new Cash Register(); register.record Purchase(19.93); register. receive Payment (20, 0, 0, 0, 0); System.out.print("Change: "); System.out.println(register.giveChange()); The code segment prints the total as 0.07000000000000028. Explain why. Give a recom- mendation to improve the code so that users will not be confused.
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 0% (1 review)
Answered By
Gaurav Kumar
I have been giving tution for 2 years....I also give tution for any competitive exams.....I teaches maths and subjects like political science,geography,history,sociology,etics
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Java Programming questions
-
123 Compare the purely graphical properties of these two notations, and the ways in which the graphical properties of each display correspond to the information structure being defined. Describe...
-
for the equality test for M and N. The question concerns how to represent multisets of strings within ML. For each of the given data representations (a), (b) and (c) describe how you would implement...
-
Explain factors governing recruitment?
-
An absorption refrigeration system receives heat from a source at 120C and maintains the refrigerated space at 0C. If the temperature of the environment is 25C, what is the maximum COP this...
-
Mavrogenes Corporation is a wholly owned Canadian subsidiary of a U.S. parent company. Mavrogenes was formed on January 1, 20X1, when the parent invested C$40 million and Mavrogenes issued 100 shares...
-
In spring 1989, Michael Jordan and the Chicago Bulls were in Indianapolis, Indiana, to play against the Indiana Pacers. At the same time, Karla Knafel was singing with a band at a hotel in...
-
Ruffalo Enterprises Inc. produces aeronautical navigation equipment. The stockholders equity accounts of Ruffalo Enterprises Inc., with balances on January 1, 2012, are as follows: Common Stock , $8...
-
Hobbits are a simple hole-dwelling folk who live in the Shire in northwestern Middle-Earth. They are known for their fondness for food and the comforts of home. Answer each of the following: a. There...
-
Recently Santa Fe, New Mexico, was named one of the safest places to live in the United States. Since then, housing development projects have been springing up all around Santa Fe. Six housing...
-
Explain the differences between 2, 2.0 , '2', "2", and "2.0".
-
Find three run-time errors in the following program. public class Has Errors { } public static void main(String[] args) { } int x = 0; int y = 0; Scanner in new Scanner("System.in");...
-
Visit www.elance.com and identify five potential outsource vendors that you could use to develop your app. Describe criteria you would use for selecting one of these vendors.
-
You will be acting as an external communication consultant for Starbucks. In your group you will discuss effective team-building strategies using the textbook as a guide and reference. In addition,...
-
1.Nonverbal communication is difficult to interpret and complex for what 3 reasons? 2.__________ codes are a distinct, organized means of expression that consist of symbols and rules for their use....
-
Two carts were given the same amount of energy at the start with cart A being half the weight of cart, B what would the resulting speed be of the two carts?
-
What alternative course of action could the Government have taken? What measures can be taken to improve the self-regulating framework of the peg to prevent further speculation against the Hong Kong...
-
Calculate the heat transferred (In btu) through a cooling coil flowing 350GPM water with an entering temp of 43 F and a T of 11F.
-
The court held that the contract, together with the check, satisfied the writing requirement. Was the writing clear and complete?
-
7. FALSE DILEMMA 8. GANDWAGON Definition: Fallacy example: How to revise argument: Definition: Fallacy example: How to revise argument:
-
Consider the cross-country example shown in Figure 3.17. How big would the window size have to be for the channel utilization to be greater than 98 percent? Suppose that the size of a packet is 1,500...
-
Suppose Host A sends two TCP segments back to back to Host B over a TCP connection. The first segment has sequence number 90: the second has sequence number I lo. a. How much data is in the first...
-
Repeat R12, hut now with the Selective Repeat Java applet. How are Selective Repeat and Go-Back-N different? Data From Problem R12 Visit the Go-sack-N Java applet at the companion Web site. a. Have...
-
In the land of Mordor, the Dark Lord Sauron rules over alarge population of Orcs. Orcs produce weapons (final output, Y)with their own work (labor input L) and using steel tools (capitalinput K),...
-
Fixed exchange rates Consider the exchange rate between the Philippine peso and the euro. Suppose the Philippine government and the Eurozone governments agree to fix the exchange rate at 2.5 pesos...
-
WHAT DID YOU LEARN FOR CHAPTER 12 - ACCOUNTING INFORMATION SYSTEMS CHAPTER 12 : The first step to protect confidentiality and privacy is to identify where such information resides and who has...
Study smarter with the SolutionInn App