Question
Write a program that executes the following steps: Create a new bank account. Show the balance of the bank account. If the balance of the
Write a program that executes the following steps:
Create a new bank account.
Show the balance of the bank account.
If the balance of the bank account is >= 20 dollars, do the following steps:
Print "Purchasing movie ticket." including the full stop at the end of the sentence.
Withdraw $20 from the account.
Show the balance of the bank account again.
Otherwise, print "You need more money to buy a movie ticket." including the full stop at the end of the sentence.
The following sample I/O shows how your program should behave when the account has at least $20:
Creating a new bank account Enter account name: user inputs Shelly Martin Enter initial balance: $ user inputs 567.00 Shelly Martin's account has $567.00 Purchasing movie ticket. Shelly Martin's account has $547.00
Otherwise, your program should behave as follows:
Creating a new bank account Enter account name: user inputs Shelly Martin Enter initial balance: $ user inputs 7.00 Shelly Martin's account has $7.00 You need more money to buy a movie ticket.
public class Exercise6 {
public static void main(String[] args) {
// INSERT YOUR CODE HERE
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started