need done in java
An experiment was conducted and resulted in a series of pH measurements. The number of samples is known ahead of time. Have your program prompt the user to enter that number of measurements. Validate the number to ensure it's in the range of 2 to 100 measurements, inclusive. If it is out range, display an error message, Error: valid range is 2 to 100
If it's within the range, then use the number of measurements to drive a counter-controlled while loop. During each iteration of the loop, prompt the user to enter a pH sample, one value at a time. When all data has been input, calculate and display the average (mean) pH value. Before calculating the mean, be sure to check for division by 0.
The input dialog and output must conform to these examples:
Good range:
Enter the number of samples: 4
Sample 1: 4.3
Sample 2: 10.1
Sample 3: 7.2
Sample 4: 8.7
Mean pH: 7.58
Bad range:
Enter the number of samples: 1
Error: valid range is 2 to 100
First, she makes the decision variables and the model of the
problem. In the case, there are 19 decision variables : Xi = buy
new sheets where i is the week
Yi = Wash at the Local Laundry where i is the week
Zi = Washing by Marry�s friends where i is the week
The cost of buying new sheet is $10, wash at the Local Laundry is
$4 and by Marry�s friends is $2, and then we can make the
model
Minimize C (cost) = 10 ( X1+X2+X3+X4+X5+X6+X7+X8) +4
(Y1+Y2+Y3+Y4+Y5+Y6) + 2 (Z1+Z2+Z3+Z4+Z5)
Subject to :
Week 1 : X1 = 115
Y1 + Z1 = 115
Week 2 : X2 = 210
Y2 + Z2 = 210
Week 3 : X3 + 0.8 Y1 = 250
Y3 + Z3 = 250
Week 4 : X4 + 0.8 Y2 + 0.8 Z1 = 230
Y4 + Z4 = 230
Week 5 : X5 + 0.8 Y3 + 0.8 Z2 = 260
Y5 +Z5 = 260
Week 6 : X6 + 0.8 Y4 + 0.8 Z3 = 300
Y6 = 300
Week 7 : X7 + 0.8 Y5 + 0.8 Z4 = 250
Week 8 : X8 + 0.8 Y6 + 0.8 Z5 = 190
X1, X2,�, Z5 >=0 and integer
For the laundry, it needs a week to finish the washing but Marry
deliver the dirty in the weekend so that the clean sheets from week
1 can be used in the week 3. And washing in Marry�s friend, they
need 2 weeks to deliver the clean sheets back and the clean sheets
can be used in the week 4. 20 % from the washing ( laundry and
Marrys friends ) are removed. In week 6, we don�t need to wash at
Marry�s friends and in the Week 7 & 8 we don�t need to wash
again because it exceeds the sport camp.
Program Screenshot:

Sample output screenshot1:

Sample output screenshot2:

Code to copy:
// import statements
import java.util.Scanner;
// Create a class BandRange
public class BadRange
{
// Main method
public static void main(String[] args)
{
// Create an object for the Scanner class
Scanner read = new Scanner(System.in);
System.out.print("Enter the number of samples: ");
// Accept the number of samples from the user
int noSamples = Integer.parseInt(read.nextLine());
// Check the number of samples input
if (noSamples < 2 || noSamples > 100)
{
// Print the error message
System.out.println("Error: valid range is 2 to 100");
// Exit from the program
System.exit(1);
}
System.out.println();
double total = 0;
int i = 0;
// Create while loop to accept the samples from the user
while (i < noSamples)
{
System.out.print("Sample " + (i + 1) + ": ");
total = total + Double.parseDouble(read.nextLine());
i++;
}
System.out.println();
// Calculate the average
double average = total / noSamples;
System.out.printf("Mean pH: %.2f", average);
}
}
need done in java An experiment was conducted and resulted in a series of pH measurements....
Project 4: Month-end Sales Report with array and validation Input dialog box for initial user prompt with good data and after invalid data Input OK Cancel Input dialog boxes with sample input for Property 1 Ingut X Input Enter the address for Property 1 Enter the value of Property 1: OK Cancel Input dialog boxes after invalid data entered for Property 1 Error Please enter anmumber greater than D Ester the walue of Peoperty t Console output END SALES REPORT...
create java application with the following specifications: -create an employee class with the following attibutes: name and salary -add constuctor with arguments to initialize the attributes to valid values -write corresponding get and set methods for the attributes -add a method in Employee called verify() that returns true/false and validates that the salary falls in range1,000.00-99,999.99 Add a test application class to allow the user to enter employee information and display output: -using input(either scanner or jOption), allow user to...
CNIT 105 In Lab10 Due: By the end of your lab session OBJECTIVES: bitwise operations main () function: 1. Declare an int variable, name it number. 2. Prompt the user to enter a whole number- read it into the variable. Validate the range in a loop. Valid range is 20 to 200 both inclusive . 3. Display the number to the screen (base 10) 4, Display the number in hexadecimal (Use %X) 5. Display number to the screen -It will...
3). Repetition Structure: Note: this question is based on question 2), feel free to add the loops directly into the code for question 2) if you want. a). Add a validation icop for question 2). The validation loop should verify that the user's input for the number of destinations is a positive number, otherwise it should display an error message and ask for another input. b). Add a loop for question 2) so that the program repeats when the user...
two part question - answered in Python 3 2). Decision Structure: A travel agency is checking whether its tours are good for customers. It follows the table below to label each tour. (e.g., if a tour has 6 destinations and its price is $600, then it should be labelled as ‘expensive’.) Number of Destinations Price Label <5 <300 or >=300 good or expensive >=5 <500 or >=500 Good or Expensive Write a program that asks the user to enter the...
Write an application in java that reads in a five-digit integer and determines whether it is a palindrome. If the number is not five digits long, display an error message and allow the user to enter a new value. Tips: 1. Determine the number of digits in the value input by the user , i.e. prompt the user to enter the number of digits of the number. Use a while loop to determine whether the user input contains the proper...
Write a C++ program using four enumerators. Initialize each as follows: 1. first, second, third, fourth, fifth, sixth, seventh, eighth, ninth 2. Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday 3. curve, fast, knuckle, slider 4. single, double, triple, homer The program should prompt a user to input a character array or 4 numbers pertaining to each enumerator. Display help text to assists the user. The help text should display the smallest and largest possible valuesfor each inputted number. Validate the...
need help!! c++
HW_6b - Calculate the average Use a do-while loop Write a program that first prompts the user for an upper limit: Enter the number of entries: 5 € (user enters 5) After the user enters a number, the program should prompt the user to enter that many numbers. For example, if the user enters 5, then the program will ask the user to enter 5 values. Use a do-while loop to add the numbers. o With each...
JAVA
*REFER TO THE PICTURES*
Summary Write a program that will calculate the monthly electric charges for a customer given a starting and ending readings from an electric meter. Charges will depend on the actual usage and the results will be displayed to the user Requirements From the user, get the month for the readings From the user, get the starting and ending reading values (in kWh) (integers) Standard rate is 42 cents per kWh Overage rate is 48 cents...
Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will be numbers between 0 and 100. Design and implement a program to prompt the user to enter each score separately. If the score is within the correct range, then increment the appropriate range If the score entered is greater than 100, display an error message, ignore the incorrect score, and prompt for the user to...