Question
Java Programming Assignment Real World Problem You are working for a small company that received a new request from XYZ Hospital . You are to
Java Programming Assignment Real World Problem
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:
o First Name and Last Name
o Address (separate fields for Address Line 1, Address Line 2, City, State, Zip, Zip + 4),
o Amount Owed, Payment Amount, Payment Date.
2. Once the user has entered this information, you must create a report of this information (Below).
Note: 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 cant 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;
public class Module02_03 {
public static void 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 ", "XYZ Community Hospital");
System.out.printf(String.format("%150s ", "").replace(' ', '='));
System.out.printf("%10s%30s%80s ", "Name", "Address", "Payment Information");
System.out.printf("%-8s %-12s %-30s %-15s %-5s %-10s %-15s %-15s %-15s ", "Last", "First", "Address Line 1", "City", "State", "Zip", "Amount Owed",
"Payment Amt.", "Payment Date");
System.out.printf(String.format("%150s ", "").replace(' ', '='));
System.out.printf("%-8s %-12s %-30s %-15s %-5s %-10s %-15s %-15s %-15s ", s1, s2, address, city, state, zip, amount, payment, date);
input.close();
}
}
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