Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write 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
Write 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: agegenderemail 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: 22 male;brad@gmail.com;65000 20 female;lucy@icloud.com;72000 21 female;angela.Samson@yahoo.com.au;51000 23-female;m_king@me.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