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
steposvetlana [31]
3 years ago
9

#include

Computers and Technology
1 answer:
gavmur [86]3 years ago
4 0

Answer:

See explaination

Explanation:

#include <fstream>

#include <iostream>

#include <iomanip>

using namespace std;

int main()

{

// Fill in the code to define payfile as an input file

ifstream payfile;

float gross;

float net;

float hours;

float payRate;

float stateTax;

float fedTax;

cout << fixed << setprecision(2) << showpoint;

// Fill in the code to open payfile and attach it to the physical file

// named payroll.dat

payfile.open("payroll.dat");

// Fill in code to write a conditional statement to check if payfile

// does not exist.

if(!payfile)

{

cout << "Error opening file. \n";

cout << "It may not exist where indicated" << endl;

return 1;

}

ofstream outfile("pay.out");

cout << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

outfile << "Payrate Hours Gross Pay Net Pay"

<< endl << endl;

// Fill in code to prime the read for the payfile file.

payfile >> hours;

// Fill in code to write a loop condition to run while payfile has more

// data to process.

while(!payfile.eof())

{

payfile >> payRate >> stateTax >> fedTax;

gross = payRate * hours;

net = gross - (gross * stateTax) - (gross * fedTax);

cout << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

outfile << payRate << setw(15) << hours << setw(12) << gross

<< setw(12) << net << endl;

payfile >> hours ;// Fill in the code to finish this with the appropriate

// variable to be input

}

payfile.close();

outfile.close();

return 0;

}

You might be interested in
Define a method named swapValues that takes an array of four integers as a parameter, swaps array elements at indices 0 and 1, a
Luba_88 [7]

The program is an illustration of arrays.

Arrays are used to hold multiple values.

The program in java, where comments are used to explain each line is as follows:

import java.util.*;

public class Main{

   //This defines the method

public static int[] swapValues(int[] arr) {

   //This swaps the first and second array elements

       int temp = arr[0];

       arr[0] = arr[1];   arr[1] = temp;

   //This swaps the third and fourth array elements

       temp = arr[2];

       arr[2] = arr[3];   arr[3] = temp;

   //This returns the swapped array to main

       return arr;

}

//The main method begins here

   public static void main(String[] args) {

       //This creates a Scanner object

       Scanner input = new Scanner(System.in);

 //This declares an array of 4 elements

 int[] intArray = new int[4];

 //This gets input for the array

 for(int i = 0; i<4;i++){

     intArray[i] = input.nextInt();

 }

 //This calls the swapValues method

 intArray=swapValues(intArray);

 //This prints the swapped array

 for (int i = 0; i < 4; i++){

 System.out.print( intArray[i]+ " ");     }

}  

}

At the end of the program, the elements are swapped and printed.

Read more about similar programs at:

brainly.com/question/14017034

6 0
2 years ago
Drag each label to the correct location. Each label can be used more than once. Match the device to the port through which it co
son4ous [18]

Answer:

Mouse - USB

Monitor - display port, HDMI, and thunderbolt port

External hard drive - USB and thunderbolt port

Flash drive - USB

Explanation:

A computer mouse is an input device used to interact with a computer system. It connects with the computer through the USB port.

A Monitor is an output device that is used to display information on a computer system. It can be connected to the system through the display ports, HDMI, and the thunder port.

The External hard drive is a storage device that holds data for a long period of time. It has adapters to connect to the computer through the USB ports or thunderbolt ports. The flash drive is similar in function to the hard drive but small in size and storage space. It only connects with the computer through USB ports.

5 0
2 years ago
7. Test Average and Grade Write a program that asks the user to enter five test scores. The program should display a letter grad
Alenkasestr [34]

Answer:

The code solution is written in Java.

  1. import java.util.Scanner;
  2. public class TestScore {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        System.out.print("Please enter first score: ");
  6.        double firstScore = input.nextDouble();
  7.        System.out.println("Grade: " + determineGrade(firstScore));
  8.        System.out.print("Please enter second score: ");
  9.        double secondScore = input.nextDouble();
  10.        System.out.println("Grade: " + determineGrade(secondScore));
  11.        System.out.print("Please enter third score: ");
  12.        double thirdScore = input.nextDouble();
  13.        System.out.println("Grade: " + determineGrade(thirdScore));
  14.        System.out.print("Please enter fourth score: ");
  15.        double fourthScore = input.nextDouble();
  16.        System.out.println("Grade: " + determineGrade(fourthScore));
  17.        System.out.print("Please enter fifth score: ");
  18.        double fifthScore = input.nextDouble();
  19.        System.out.println("Grade: " + determineGrade(fifthScore));
  20.        System.out.println("Average score: " + calcAverage(firstScore, secondScore, thirdScore, fourthScore, fifthScore));
  21.    }
  22.    public static double calcAverage(double score1, double score2, double score3, double score4, double score5){
  23.        double average = (score1 + score2 + score3 + score4 + score5) / 5;
  24.        return average;
  25.    }
  26.    public static String determineGrade(double score){
  27.        if(score >= 90){
  28.            return "A";
  29.        }
  30.        else if(score >= 80 ){
  31.            return "B";
  32.        }
  33.        else if(score >=70){
  34.            return "C";
  35.        }
  36.        else if(score >=60){
  37.            return "D";
  38.        }
  39.        else{
  40.            return "F";
  41.        }
  42.    }
  43. }

Explanation:

Firstly, create the method, <em>calcAverage()</em>, that takes five test scores. Within the method, calculate the average and return it as output. (Line 33 - 36)

Next, create another method, <em>determineGrade()</em>, which takes only one score and return the grade based on the range of the  score. (Line 38 -54)

Once the two required methods are created, we are ready to prompt use for input five test scores using Java Scanner class. To use get user input, create a Scanner object (Line 7). Next, use getDouble() method to get an input score and assign it to variables firstScore, secondScore, thirdScore, fourthScore & fifthScore, respectively. Once a score input by user, call determineGrade() method by passing the input score as argument and immediately print out the return grade. (Line  9 - 27)

At last, call calcAverage() method by passing the first test score variables as argument and print out the returned average value. (Line 29).

5 0
2 years ago
NEED FIVE QUESTIONS ANSWERED!!! take your time~
DochEvi [55]
  1. A
  2. C
  3. C
  4. B
  5. A

I'M NOT 100% SURE i hope this helps you

4 0
3 years ago
Pendant Publishing edits multi-volume manuscripts for many authors. For each volume, they want a label that contains the author’
tigry1 [53]

Answer:

The answer to this question can be described as follows:

Explanation:

The Pseudocode to this question can be described as follows:

start  \\ start process

Declaration of variable

Input_File records.txt

Output_File result.txt

string author_Name , title

int number_of_volume

open Input_File

open Output_File

input author_Name, title, number_of_volume from records.txt

while not eof \\ start loop and eof is end of file  

output author_Name

output title

output number_of_volume

end while  \\end loop

close records.txt  \\close file

close results.txt   \\close file

END \\end the code

8 0
2 years ago
Other questions:
  • Which statement describes the primary purpose of JavaScript?
    8·1 answer
  • Trevor got home from work and suddenly realized that he needed to edit a certain file stored in the company network's server. ho
    11·1 answer
  • Which of the statements below is false? Question 19 options: a) You can install a 64-bit operating system on a 64-bit machine. b
    12·1 answer
  • On the CallCenterReport worksheet, add formulas that will summarize the issues for the department entered in cell B3. In cell B6
    13·1 answer
  • What did Edison's device to view motion pictures inspire the Lumiere brothers to invent?
    14·1 answer
  • The ________ is an area where you can position fields to use for filtering the PivotTable and thereby enabling you to display a
    11·1 answer
  • Warm colors including red, yellow and orange _____________ be energetic and exciting to the eye, while cool colors in blue, gree
    11·1 answer
  • What is key for evaluating internal controls such as human resources, logistics, information technology, risk, legal, marketing
    11·1 answer
  • You can click the ____ button to undo an automatic correction.
    9·1 answer
  • Which tab on the ribbon in the folder window allows users to change how the contents of the folder are being shown?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!