Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transport Operations

Authors: Allen Stuart

2nd Edition

978-0470115398, 0470115394

Students also viewed these Programming questions

Question

=+Do the goals and policies exploit industry opportunities?

Answered: 1 week ago

Question

Q .1. Different ways of testing the present adulterants ?

Answered: 1 week ago

Question

Q.1. Health issues caused by adulteration data ?

Answered: 1 week ago

Question

1. Traditional and modern methods of preserving food Articles ?

Answered: 1 week ago

Question

What is sociology and its nature ?

Answered: 1 week ago