You are working for a small company that received a new request from XYZ Hospital . You
Question:
You are working for a small company that received a new request from XYZ Hospital . You are to create a Proof of Concept to a portion of the features for this app. By the end of module 3, you are to create a proof of concept application to create a report for of the hospital's patients. This report has the following requirements:
1. Allow the user to enter the following information about a hospital patient:
- First Name and Last Name
- Address (separate fields for Address Line 1, Address Line 2, City, State, Zip, Zip + 4),
- Amount Owed, Payment Amount, Payment Date.
2. Once the user has entered this information, you must create a report of this information (Below).
At this time, the client does not need multiple patients output to the report. All you must be able to do is to ask the user for the required information for a single person and then output a report. The client will then review the report and let your company know whether to continue with the report.
XYZ Community Hospital
Name Address Payment Information
Last First Address Line 1 City State Zip Amount Owed Payment Amt. Payment Date
Doe John 1234 Test Drive AnyCity IN 12345-1234 $2000.00 $20.00 10/02/2017
This is the part I can’t figure out.
In module 02, you started a report for XYZ Hospital (which looks like above) . You have been tasked to continue this assignment. The proof of concept has been accepted and you are to make the following changes:
· Allow the user to enter multiple patients.The user should be able to indicate when they are done entering patients (in other words, the number of patients to include on the report has not been specified).
· You are to validate the data so that no errors occur (for example, the user should not be allowed to enter non-numeric characters and must enter 5 digits for a zip code).
Here is my code:
import java.util.Scanner;
publicclass Module02_03 {
publicstaticvoid main(String[] args) {
Scanner input = new Scanner(System. in );
System. out .print("Enter last name ");
String s1 = input.nextLine();
System. out .print("Enter first name ");
String s2 = input.nextLine();
System. out .print("Enter address ");
String address = input.nextLine();
System. out .print("Enter city ");
String city = input.nextLine();
System. out .print("Enter state ");
String state = input.nextLine();
System. out .print("Enter zip ");
String zip = input.nextLine();
System. out .print("Enter amount owed ");
String amount = input.nextLine();
System. out .print("Enter payment amount ");
String payment = input.nextLine();
System. out .print("Enter payment date ");
String date = input.nextLine();
System. out .printf("%80s\n", "XYZ Community Hospital");
System. out .printf(String. format ("%150s\n", "").replace(' ', '='));
System. out .printf("%10s%30s%80s\n", "Name", "Address", "Payment Information");
System. out .printf("%-8s %-12s %-30s %-15s %-5s %-10s %-15s %-15s %-15s \n", "Last", "First", "Address Line 1", "City", "State", "Zip", "Amount Owed",
"Payment Amt.", "Payment Date");
System. out .printf(String. format ("%150s\n", "").replace(' ', '='));
System. out .printf("%-8s %-12s %-30s %-15s %-5s %-10s %-15s %-15s %-15s \n", s1, s2, address, city, state, zip, amount, payment, date);
input.close();
}
}
Strategic Management An Integrated Approach
ISBN: 978-1111825843
10th edition
Authors: Charles W. L. Hill, Gareth R. Jones