Question
Code a Java program, using appropriate methods and parameter passing, that obtains from the user the following items: a person's age, the person's gender (male
Code a Java program, using appropriate methods and parameter passing, that obtains from the user the following items: a person's age, the person's gender (male or female), the person's email address, and the person's annual salary. The program should continue obtaining these details for as many people as the user wishes. As the data is obtained from the user
validate the age to ensure that the value lies in the range 20 to 30 inclusive; you may assume that the user will enter whole numbers only.
validate the salary to ensure that it lies in the range 40000 to 150000 inclusive; you may assume that the user will enter whole numbers only.
write the data to a text file named salaries.txt in the following format:
age;gender;email address;salary
Note: each line of data represents one person and each data value is separated by a semicolon (;).
Hence the data in the file that you create would look similar to: 2..d@geemail.com;65000 2..y@hehe.com;72000 2..n@hoo.co.uk;51000 2..g@htm.com;125000
When the program terminates it should display to the screen how many of the people were male and how many were female that were written to the file.
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