Explore BrainMass
Share

program that reads this information and calculates

This content was STOLEN from BrainMass.com - View the original, and get the already-completed solution here!

People from three different income levels, A, B, and C, rated each of two different products with a number 0 through 10. Construct a file in which each line contains the income level and product rankings for one respondent. Then write a program tht reads this information and calculates the following:
a. for each income bracket, the average rating for product 1;
b. the number of persons in income bracket B who rated both products with a score of 5 or higher;
c. the average rating for product 2 by persons who rated product 1 lower than 3.
Label all output, and design the program so that it automatically counts the respondents.

© BrainMass Inc. brainmass.com October 16, 2018, 4:38 pm ad1c9bdddf
https://brainmass.com/computer-science/files/program-that-reads-this-information-and-calculates-31644

Solution Summary

Write a program that reads this information and calculates the following:
a. for each income bracket, the average rating for product 1;
b. the number of persons in income bracket B who rated both products with a score of 5 or higher;
c. the average rating for product 2 by persons who rated product 1 lower than 3.
Label all output, and design the program so that it automatically counts the respondents.

$2.19
Similar Posting

Question about A java program to read values and calculate payroll

Modify the Payroll Program application so it continues to request employee information until the user enters stop as the employee name. In addition, program the application to check that the hourly rate and number of hours worked are positive numbers. If either the hourly rate or the number of hours worked is not a positive value, the application should
prompt the user to enter a positive amount.

The teacher posted that this is what the program should have looked like:
import java.util.Scanner;

public class Payroll
{
public static void main (String args[])
{

String name;
double payRate;
double hours;
double weeklyPay;

Scanner input = new Scanner(System.in);

System.out.print("Enter name: ");
name = input.next();

System.out.print("Enter payrate: "); // prompt
payRate = input.nextDouble();

System.out.print("Enter hours: "); // prompt
hours = input.nextDouble();

weeklyPay = payRate * hours;

System.out.print(name + " earned ");
System.out.printf("$ %.2fn", weeklyPay);

} //end of main method

} // end of Payroll class

Can you do the modifications and post the solution in the correct format, or tell me how I get it to the .java file extension?

View Full Posting Details