Question: java Assume that five int variables, expense1, expense2, expense3, cents, and dollars have been declared. The three expense variables represent three different expenses, in pennies.

java Assume that five int variables, expense1, expense2, expense3, cents, and dollars have been declared. The three expense variables represent three different expenses, in pennies. Your code should compute the total expense (the sum of the three expenses) and assign the dollar portion of the total expense to dollars and the cents portion to cents. For example, if the three expenses were representing $500.00, $250.12, $15.95 (with expense1, expense2, expense3, containing the int values 50000, 25012, and 1595 respectively) dollars should get 766 and cents should get 7.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the Java code that calculates the total expense in dollars and cents Java public class Expense... View full answer

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 Accounting Questions!