Question: Presenting calculations with limited decimal points is an important skill to learn. The code below has both correct and incorrect code, so you can understand

Presenting calculations with limited decimal points is an important skill to learn. The code below has both correct and incorrect code, so you can understand what each word and punctuation mark of a casting calculation does.
Instructions: Match the casting code with its value. Watch out for the parentheses and the data type. Assume the following:
cost is 1293.42
discountRate is 0.20
discount is cost times discountRate.
discount = cost * discountRate;
Answer 1
Choose...
discount = cost * discountRate *100;
Answer 2
Choose...
discount =(int) cost * discountRate *100;
Answer 3
Choose...
discount =(int)(cost * discountRate *100);
Answer 4
Choose...
discount =(int)(cost * discountRate *100)/100;
Answer 5
Choose...
discount =(int)(cost * discountRate *100)/100.0;
Answer 6
Choose...
discount =(int)(cost * discountRate *10)/10.0;

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!