Can you write an source code for this problem? Create an AddCoins application th
ID: 3653465 • Letter: C
Question
Can you write an source code for this problem?
Explanation / Answer
public class AddCoins { DataInputStream dis = new DataInputStream(System.in); int penny,dime,quarter,nickel; float dollar; void start () { try { System.out.println("Enter the number of pennies "); penny = Integer.parseInt(dis.readLine()); System.out.println("Enter the number of dimes"); dime = Integer.parseInt(dis.readLine()); System.out.println("Enter the number of nickels"); nickel = Integer.parseInt(dis.readLine()); System.out.println("Enter the number of quarters"); quarter = Integer.parseInt(dis.readLine()); dollar = (penny+(dime*10)+(nickel*5)+(quarter*25))/100; System.out.println("Total :$"+dollar); } catch(Exception e) { System.out.println(e); } void getDollarAmount(int penny1,int dime1,int quarter1,int nickel1) { float dollar1; dollar1 = (penny1+(dime1*10)+(nickel1*5)+(quarter1*25))/100; System.out.println("Total :$"+dollar1); } } public static void main(String args[]) { AddCoins ac = new AddCoins(); ac.start(); } }
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.