Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a new Eclipse project named LablHWLastnameFirstname and a new class withi

ID: 3881550 • Letter: C

Question

Create a new Eclipse project named LablHWLastnameFirstname and a new class within that project named $1 bills, S5 bills, S10 bills, and $20 bills in a cash register. The program should then compute and display hovw CashRegister. Write a program that allows the user to enter the quantity of pennies, nickels, dimes, quarters much money is in coins, how much money is in bills, and the total amount of money. The money amounts Note: This is a long-ish program, but it's very repetitive! Make liberal use of copy+paste (Ctrl+C, Ctrl+V) to Here's an example of what your program might look like when you run it. The underlined portions indicate P A should be reported in Sdollars.cents format (see below) HP Po save yourself coding time :) what you type in as the program is running Cash Register Buddy v1.0 Enter the quantity of: Pennies: 57 Nickels: 12 Dimes: 83 Quarters: 68 $1 Bills 45 $5 Bills: 30 $10 Bills: 52 $20 Bills: 17 Total in coins $26.47 Total in bills: $1055.0 Grand total: $1081.47

Explanation / Answer

import java.io.*;

import java.util.Scanner;

class CashRegister {

public static double findTotalCash(int bill1,int bill5,int bill10, int bill20) {

return (1*bill1 + 5*bill5 + 10*bill10 + 20*bill20);

  

}

  

public static double findTotalCoins(int Pennies,int Nickels,int Dimes, int Quarters) {

// 1 pennies = 0.01

//1 Nickels = 0.05

//1 dimes=0.1 dollar

double result = 0.01*Pennies + 0.05*Nickels + 0.1 *Dimes + 0.25 *Quarters;

return result;

}

  

public static void main (String[] args) {

System.out.println("Cash register buddy v1.0");

System.out.println("Enter the quantity of:");

Scanner s = new Scanner(System.in);

System.out.print("Pennies: ");

int Pennies = s.nextInt();

System.out.println(Pennies);

System.out.print("Nickels: ");

int Nickels = s.nextInt();

System.out.println(Nickels);

System.out.print("Dimes: ");

int Dimes = s.nextInt();

System.out.println(Dimes);

System.out.print("Quarters: ");

int Quarters = s.nextInt();

System.out.println(Quarters);

System.out.print("$1 bills: ");

int bill1 = s.nextInt();

System.out.println(bill1);

System.out.print("$5 bills: ");

int bill5 = s.nextInt();

System.out.println(bill5);

System.out.print("$10 bills: ");

int bill10 = s.nextInt();

System.out.println(bill10);

System.out.print("$20 bills: ");

int bill20 = s.nextInt();

System.out.println(bill20);

  

double coins = findTotalCoins(Pennies,Nickels,Dimes, Quarters);

System.out.println("Total in coins : $" + coins);

double cash = findTotalCash(bill1,bill5,bill10, bill20);

System.out.println("Total in bills : $" + cash);

System.out.println("Grand total : $" + (cash + coins));

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote