ADVANCED JAVA: Task 1: Write a program that displays and gives comments for a movie or a TV show. The program starts by displaying comments
ADVANCED JAVA:
Task 1:
Write a program that displays and gives comments for a movie or a TV show. The program starts by displaying comments that were given by others to the screen and asking the user to type in his/her own comments. The program then ends. The next person to run the program sees all the comments given by the previous users. If a user is the first person to run the program, then display an appropriate message to the user and ask him/her to comment. The comments are kept in a text file and the content of the file changes after each run of the program.
Your program reads and stores only three lines of comments at most. You may ask the user to press the Return key two times to end the comment. Your program can then test to see that it has reached the end of the input accordingly.
Task 2:
Step 1:
Define a bank account class with appropriate getters and setters and a toString method. The class has three attributes: account number, balance and customer ID. Write a tester class that should place the code of taking user inputs into a try-catch block with multiple checks to check for the validity of various attributes based on the following criteria.
a. Customer ID must start with a letter and should be followed by four digits.
b. Account number must be of six digits.
c. Initial balance must be above $500.
Print suitable error messages within the catch block. If any of the criteria mentioned above is not fulfilled, the program should loop back and let the user enter new data. Then create a bank account object and call the toString method of the object to display the account details.
Step 2:
Modify the previous exercise to include methods for amount deposited and amount withdrawn in the back account class. Create your own exception class which will check inside the method for the amount deposited so that after the deposit, the maximum balance in the account must not be more than $5000. Also, check inside the method for amount withdrawn so that the available balance after the withdrawal does not go below $500. Modify your tester class accordingly to invoke the defined methods from your main method.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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