Java SE 6 validating Required data elements

coach2winstate

New Member
Joined
Jun 16, 2009
Messages
2
I need help Validating the required data elements in this program. I need the Patient id,Patient last name Patient first name, Patient primary care physician, Patient address1,Patient city, Patient State, Patient zip. all validated (entered as non-spaces) If invalid data is ,entered, display an "invalid input of type .. Record reject" message and use the COUNTINUE statement to return to the top of the loop to allow a new entry to be made.

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>import java.util.Scanner;</o:p>
<o:p>public class medrecord {</o:p>
<o:p> /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner string = new Scanner (System.in);
String choice="y";
while(choice.equalsIgnoreCase("y"))
{
System.out.println("Welcome to program 1 Medical Record Program");

System.out.println(); //insert a blank line

//enter patient information

System.out.println("Patient ID?");
String id = string.nextLine();

System.out.println("Patient Last Name?");
String name = string.nextLine();</o:p>

<o:p> System.out.println("Patient First Name?");
String name2 = string.nextLine();

System.out.println("Patient Middle Name?");
String name3 = string.nextLine();</o:p>

<o:p> System.out.println("Patient Date of Birth?");
String dob = string.nextLine();

System.out.println("Patient SSN #?");
String ssn = string.nextLine();</o:p>

<o:p> System.out.println("Patient Address 1?");
String adress = string.nextLine();</o:p>

<o:p> System.out.println("Patient Address 2?");
String adress2 = string.nextLine();</o:p>

<o:p> System.out.println("Patient City?");
String city = string.nextLine();</o:p>

<o:p> System.out.println("Patient State?");
String state = string.nextLine();</o:p>

<o:p> System.out.println("Patient Zip code?");
String zip = string.nextLine();</o:p>

<o:p> System.out.println("Patient Primary Care Physician?");
String pricrphy = string.nextLine();

System.out.println("Patient primary insurance compay?");
String insur = string.nextLine();</o:p>

<o:p> System.out.println("Patient primary insurance ID?");
String insid = string.nextLine();</o:p>

<o:p> System.out.println("Patient secoundary insurance compay?");
String insur2 = string.nextLine();</o:p>

<o:p> System.out.println("Patient secoundary insurance ID?");
String insid2 = string.nextLine();</o:p>

<o:p> System.out.println("Patient next of kin emergancy contact?");
String emrcont = string.nextLine();</o:p>

<o:p> System.out.println("Patient home phone number?");
String numres = string.nextLine();</o:p>

<o:p> System.out.println("Patient work number?");
String numwrk = string.nextLine();</o:p>

<o:p> System.out.println("Patient cell phone number?");
String numcel = string.nextLine();


System.out.println(); //insert a blank line</o:p>

<o:p> System.out.println("Patient ID: " + id);
System.out.println("Last Name: " + name);
System.out.println("First Name: " + name2);
System.out.println("MI: " + name3);
System.out.println("Date Of Birth: " + dob);
System.out.println("SSN: " + ssn);
System.out.println("Address: " + adress);
System.out.println("Address 2: " + adress2);
System.out.println("City: " + city);
System.out.println("State: " + state);
System.out.println("Zip Code: " + zip);
System.out.println("Patient Primary Care Physician: " + pricrphy);
System.out.println("Patient Primary Insurance Company: " + insur);
System.out.println("Patient Primary Insurance ID: " + insid);
System.out.println("Patient Secoundary Insurance Company: " + insur2);
System.out.println("Patient Secoundary Insurance ID: " + insid2);
System.out.println("Emergancy Contact: " + emrcont);
System.out.println("Residential phone number: " + numres);
System.out.println("Work phone number: " + numwrk);
System.out.println("Cellular phone number: " + numcel);
System.out.print("Coutinue ? (y/n):");
choice=string.nextLine();
System.out.println();

}//end while</o:p>

<o:p> }// end main
}//end class</o:p>

<o:p></o:p>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,225,399
Messages
6,184,752
Members
453,254
Latest member
topeb

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top