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

Please help below is my code for this project and it compiles and runs but i kee

ID: 3879284 • Letter: P

Question

Please help below is my code for this project and it compiles and runs but i keep getting an error that says: [ERROR] ATM.java:77 (Line 77 of the program esle part of statement): 'else' construct must use '{}'s. [NeedBraces] The only problem is without the else part of the project it still runs but automatically shows the amount of "300 exceeded". Also below the code is a picture of the assignment and how the ouput of the program should look exactly.

1 /**
2 *Program to create an ATM
3 *
4 */
5 import java.util.Scanner;
6 /**
7 *Program lets user enter amount in whole dollars.
8 *Number of bills to be dispensed by denomination.
9 *Limit of 300 dollars must not be exceeded.
10 *Uses a scanner imported from the java library.
11 *
12 *@author Julian Woods
13 *@version January 26, 2018
14 */
15 public class ATM
16 {
17 /**
18 *Prints the amount of bills to std output.
19 *Also prints calculations for the program.
20 *
21 *@param args Command line arguments (not used).
22 */
23 public static void main(String[] args)
24 {
25 //Scanner for user to read in
26 Scanner sc = new Scanner(System.in);
27 System.out.println("Enter the Amount: ");
28 int amt = sc.nextInt();
29 int amtstore = amt;
30 if (amt <= 300)
31 {
32 int ten = 0, five = 0;
33 // twenty variable is used for calculating $20 Denomination
34 int twenty = amt / 20;
35 amt = amt - (20 * twenty);
36 if (amt != 0) // Here if amount is zero after after $20 program ends
37 {
38 // ten variable is used for calculating $10 Denomination
39 ten = amt / 10;
40 amt = amt - (10 * ten);
41 }
42 if (amt != 0) //// Here if amount is zero after after $10 program ends
43 {
44 // ten variable is used for calculating $5 Denomination
45 five = amt / 5;
46 amt = amt - (5 * five);
47 }
48
49 // If amount is remaining after all
50 // above process it is for $1 denomination.
51
52 // Displaying Billing Denomination
53
54 System.out.println("Billing by denomination");
55 if (twenty != 0)
56 {
57 System.out.println(" $20: " + twenty);
58 if (ten != 0)
59 {
60 System.out.println(" $10: " + ten);
61 if (five != 0)
62 {
63 System.out.println(" $5: " + five);
64 }
65 if (amt != 0)
66 {
67 System.out.println(" $1: " + amt);
68 }
69 }
70 }
71 System.out.println(amtstore + " = (" + twenty
72 + " * $20) + (" + ten + " * $10) + ("
73 + five + " * $5) + (" + amt + " * $1)");
74
75 }

ATM.java Requirements: An ATM manufacturer would like a program that allows the user to enter the amount of cash in whole dollars and then displays the number bills by denomination be dispensed if the limit of $300 is not exceeded. Design: The ATM manufacturer would like the output to look as shown below when 400 is entered as the amount for one run and 279 is entered for another run. Line number Program output Enter the amount: 400 2 Limit of $300 exceeded! Line number Program output Enter the amount: 279 Bills by denomination: $20: 13 $10: 1 4 $5:1 $1: 4 $279-(13$20) (1 $10) (1 $5) (4$1) 7 Your program must follow the above format with respect to the output. Note that lines 3 through 6 for the amount 279 begin with tab, which is set to three spaces in jGRASP(i.e. your output should use the escape sequence for a tab).

Explanation / Answer

Note: I think now perfectly working.If u want me to do any further changes in this..Just tell me..I will modify..Thank You

______________

ATM.java

/**
*Program to create an ATM
*
*/
import java.util.Scanner;
/**
*Program lets user enter amount in whole dollars.
*Number of bills to be dispensed by denomination.
*Limit of 300 dollars must not be exceeded.
*Uses a scanner imported from the java library.
*
*@author Julian Woods
*@version January 26, 2018
*/
public class ATM {
/**
*Prints the amount of bills to std output.
*Also prints calculations for the program.
*
*@param args Command line arguments (not used).
*/
public static void main(String[] args) {
//Scanner for user to read in
Scanner sc = new Scanner(System.in);
System.out.println("Enter the Amount: ");
int amt = sc.nextInt();
int amtstore = amt;
if (amt <= 300) {
int ten = 0, five = 0;
// twenty variable is used for calculating $20 Denomination
int twenty = amt / 20;
amt = amt - (20 * twenty);
if (amt != 0) // Here if amount is zero after after $20 program ends
{
// ten variable is used for calculating $10 Denomination
ten = amt / 10;
amt = amt - (10 * ten);
}
if (amt != 0) //// Here if amount is zero after after $10 program ends
{
// ten variable is used for calculating $5 Denomination
five = amt / 5;
amt = amt - (5 * five);
}

// If amount is remaining after all
// above process it is for $1 denomination.

// Displaying Billing Denomination

System.out.println("Billing by denomination");
if (twenty != 0) {
System.out.println(" $20: " + twenty);

}
if (ten != 0) {
System.out.println(" $10: " + ten);

}
if (five != 0) {
System.out.println(" $5: " + five);
}
if (amt != 0) {
System.out.println(" $1: " + amt);
}
System.out.println(amtstore + " = (" + twenty + " * $20) + (" + ten + " * $10) + (" + five + " * $5) + (" + amt + " * $1)");

} else {
System.out.println("Limit of 300$ exceded!");
}
}
}

_________________

Output:

Enter the Amount:

279

Billing by denomination

$20: 13

$10: 1

$5: 1

$1: 4

279 = (13 * $20) + (1 * $10) + (1 * $5) + (4 * $1)

________________

Output:2

Enter the Amount:

400

Limit of 300$ exceded!

______________

Output#3:

Enter the Amount:

189

Billing by denomination

$20: 9

$5: 1

$1: 4

189 = (9 * $20) + (0 * $10) + (1 * $5) + (4 * $1)

_______________Thank You

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