![jaylaa04](/avatars/21902.jpg)
jaylaa04
06.04.2021 •
Computers and Technology
Create a C program that reads in text file AP7-1.txt and creates a comma separated file called AP7-2.csv. Calculate Gross Pay by multiplying hours worked by rate of pay. The first row in file AP7-2.csv should be headers for each data element. The data elements for output in the comma separated data file are employee ID number (int), hours worked (double), rate of pay (double) and gross pay (double). Your output file contents should look similar to: Emp ID
Solved
Show answers
More tips
- C Computers and Internet Can You Insert a Regular SIM Card into an iPad? Let s Find Out...
- F Food and Cooking Лечо: вкусное и простое блюдо для любой кухни...
- H Health and Medicine Relieving Swelling in Legs: Causes and Ways to Alleviate the Symptom...
- S Style and Beauty How to Get Rid of a Bruise: Tips and Tricks...
Answers on questions: Computers and Technology
- C Computers and Technology Write a complete C++ program that do following. Read a positive integer from the user with proper prompt. Assume that this user is nice and he/she would not start the integer...
- M Mathematics Which system of equations has exactly one solution? 2 x - 4 y = 8. x + y = 7. 3 x + y = - 1. 6 x + 2 y = - 2. 3 x + 3 y = 3. -6 x -6 y = 3. 3 x - 2 y = 4. - 3 x + 2 y = 4....
- H History (02.02 lc) one weakness of the articles of confederation was that it...
- M Mathematics Barbara is deciding between banquet chefs and cece’s catering to cater an awards banquet. barbara needs to choose the company that costs less, but she does not yet know how...
- E English Analyze how the raven in edgar allen poes the raven develop the speaker s character ,be sure to use specific details from the poem to support your ideas...
- M Mathematics What are the zeros of the function f(c)=x^2+2x-8/x^2-2x-8...
- S Social Studies Question 5which statement about enslaved african americans is false? they were allowed to maintain a family life.they were allowed to practice religion.they were allowed to...
- S Social Studies Maslow found that self-actualizing people have the following characteristics: a. a capacity to tolerate and even welcome uncertainty in their lives. b. spontaneity and creativity....
- B Business Amazon s use of the internet as a platform to sell books more efficiently than traditional bookstores illustrates a use of information services for: low-cost leadership marketing...
- B Biology Which action results from the combination of gravity and inertia working on the moon? the moon s orbit around earth earth s downward pull on the moon the moon s push against...
Ответ:
// Scanner class is imported so that the program can can user input
import java.util.Scanner;
// class Solution is defined
public class Solution {
//main method which begin program execution is defined
public static void main(String args[]) {
// Scanner object scan is defined to receive input fromkeyboard
Scanner scan = new Scanner(System.in);
// A prompt is display to the user asking for number of grade
System.out.println("How many grade do you want to enter");
// The user input is assigned to numOfGrade
int numOfGrade = scan.nextInt();
// An array of integer called gradeArray is declared
// it has numOfGrade as length
int[] gradeArray = new int[numOfGrade];
// for-loop that prompt the user to enter grade to fill the gradeArray
for(int i = 0; i < numOfGrade; i++){
System.out.println("Enter a grade: ");
int grade = scan.nextInt();
gradeArray[i] = grade;
}
// sun variable is declared and initialized to 0
int sum = 0;
// numOfFail is declared and initialized to 0
int numOfFail = 0;
// for-loop through the gradeArray that add all element
// it also increase the counter for numOfFail if grade is < 70
for(int j = 0; j < gradeArray.length; j++){
sum += gradeArray[j];
if (gradeArray[j] < 70){
numOfFail++;
}
}
// aveargeGrade is calculated
int averageGrade = (sum / numOfGrade);
// numOfFail is displayed to the user
System.out.println("Number of fail is: " + numOfFail);
// the averageGrade is also displayed.
System.out.println("Average grade is: " + averageGrade);
}
}
Explanation:
The code is well commented and written in Java.