1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Roman55 [17]
3 years ago
10

A small company is moving all its employee data to a computer. To make a smooth transition, a software program will permit the d

ata entry personnel to enter data into a file. Design a program that writes the employees.dat file. The program should accept user input until the user indicates there are no more records to write. The Employees file contains four fields (see the Input File Description). The program will use the employee ID as criteria to determine a current employee. Validate the employee ID and employee wage fields per the requirements below. You may use any of the library functions presented in Chapter 6 of the textbook to assist in validation. Your validation routines should include error messages and allow the user to correct an input error. Use an array to hold the valid ID numbers.
Input File Description:
File: employees.dat
Field Description Data Type
Employee first name String
Employee last name String
Employee ID # String
Employee Hourly Wage Real (2 decimal places)

Output Report - Printer Spacing Chart:
GTC1305 Company
Employee Report
Employee Name Identification Number Wage

XXXXXXXXXX XXXXXXX XXXXXXXXXX $Z9.99
Computers and Technology
1 answer:
Llana [10]3 years ago
7 0

Answer:

Explanation:

This program should hold three functions for easy usage. The first will be a main function, the second will be a check function, the third will be a write function.

Main function:

First task should be to create the file using different functions which ae different for every language, like in java the function FileOutputStream will be used to make the file and PrintWriter can be used to enter data into the aforementioned file.

FileOutputStream fout=new FileOutputStream("employees.dat");

PrintWriter pw=new PrintWriter(fout);

or

PrintWriter pw=new PrintWirter(new FileOutputStream(“employees.dat”));

What we will do next is to run a do while loop which asks for the employee ID. Then it checks whether the ID is valid or not using the check function. If is comes out to be valid, then we will send the id to the write function where the further details of the employee will be asked. If it comes out to be invalid, an error message is to be printed stating that the input is wrong. Finally, we will ask the number that whether they want to enter more data. This condition will be put in the while and it will terminate the loop once the user says no more data.

Check function:

We will take a flag variable throughout the function which will keep track whether the number is valid or not.

Firstly, we will check that the entered id is less than 10 characters long. If no, then change the flag variable to invalid.

There are 5 valid id numbers that an entered id number must contain. These 5 can be entered into the system as an array.

Then in a loop we will check that whether one of these exists as a substring of the entered number.

boolean check=false;  

//here check is the flag variable. If it remains false, it means that the entered ID is not valid.

if(length<=10)

           {

               String chch[]={"RE49762358","PR156125","OF45461","RE68566547","PR156984"};

               for(int i=0;(i<5)&&(!check);i++)

               {

                   int len1=chch[i].length();

                   for(int j=0;(j<=len-len1)&&(!check);j++)

                   {

                       String check12;

                       if(j+len+1==len)

                       check12=str.substring(j);

                       else

                       check12=str.substring(j,j+len1);

                       if(check12.equals(chch[i])){check=true;}

                   }

               }

           }

After the completion of loop, we can check return the flag variable to the main function.

Write function:

The print writer function written before shows it work here. First, we input the employee first name, last name and the employee hourly wage from the user. Do have a check statement for the hourly wage to be less than $45.50. If all conditions are fulfilled, then print all the details to the file.

pw.println(first_name);

pw.println(last_name);

pw.println(employee_id);

pw.println(hourly_wage);

pw.flush();            

You might be interested in
Match the fallacy with its name. Being a speaker of Spanish, I'm also great at speaking Italian.
tresset_1 [31]
Straw man
eg. "Senator Jones says that we should not fund the attack submarine program. I disagree entirely. I can't understand why he wants to leave us defenseless like that."

Ad hominem
eg. “How can you argue your case for vegetarianism when you are enjoying your steak?”

Over simplication
eg. President Bush wants our country to trade with Fidel Castro's Communist Cuba. I say there should be a trade embargo against Cuba. The issue in our election is Cuban trade, and if you are against it, then you should vote for me for president.

Bandwagon
eg. Everyone is selfish; everyone is doing what he believes will make himself happier. The recognition of that can take most of the sting out of accusations that you're being "selfish." Why should you feel guilty for seeking your own happiness when that's what everyone else is doing, too?

Black or white
eg. Well, it's time for a decision. Will you contribute $20 to our environmental fund, or are you on the side of environmental destruction?
3 0
3 years ago
What technology is being used when you are sent an email saying you can track your package?
LuckyWell [14K]

The technology is being used when you are sent an email saying you can track your package is known to be a scan code.

<h3>What are code-scanning technology?</h3>

This is known to be called a barcode reader or simply say a barcode scanner.

It is seen as a kind of an optical scanner that tends to read printed barcodes, as well as be able to decode the data that are found in the barcode and transmit the data to a computer.

Hence, The technology is being used when you are sent an email saying you can track your package is known to be a scan code.

Learn more about scan code from

brainly.com/question/24937533

#SPJ1

4 0
1 year ago
The main reason to set a field size in access is to:
Nadya [2.5K]
The main reason to set a field size in access is to limit the lengths of value in the table.
Field size determines the limits or determines the maximum of text that can be input in the text or number field. Also, it may reduce data entry errors in changing the field size in access.
4 0
3 years ago
Two technicians are discussing fully charged battery voltage readings. technician a says that it should read approximately 12.6v
Veronika [31]

I prefer to choose the technician A. It should read approximately 12.6V. Volts is the basic unit used to measure voltage and I think the technician B stating the mv units in her reading comes from the units of his multitesters setting.

3 0
3 years ago
Which laptop part is usually replaceable through unlocking it, pulling it out, and then replacing it with a new one?
leva [86]

Answer:

maccbook

Explanation:

maccbooks r awesome

7 0
2 years ago
Read 2 more answers
Other questions:
  • Discuss the differences between dimensionality reduction based on aggregation and dimensionality reduction based on techniques su
    13·1 answer
  • Sizing handles are used in Microsoft® Word® to _____.
    13·1 answer
  • What is resource Management in Wireless Communication ? Explain its Advantages?
    6·1 answer
  • Your boss wants to utilize some sort of cloud storage for his files so that all of his
    10·2 answers
  • Pros and cons of access to a wide range of online services when it comes to an individual's safety?
    14·1 answer
  • Community gardens are public gardens where local residents can grow plants in a plot. They are very popular, so there are often
    7·1 answer
  • Write a function namedmake_complex that stores its twoarguments (both of type double) in acomplex structure, then returns thestr
    12·1 answer
  • This help me please. ​
    8·1 answer
  • The different languages that follow specific RULES. These languages use commands
    9·1 answer
  • A ___ is a type of computer that is small and portable?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!