Answered step by step
Verified Expert Solution
Question
1 Approved Answer
answer in c++ please answer in c++ please The first picture is the problem. the second picture is a sample output Problem: Create a program
answer in c++ please
answer in c++ please
The first picture is the problem. the second picture is a sample output
Problem: Create a program that will ask scientist in tracking the resistances of products from various batches. The resistances of good resistors should be between 3 and 3.5 inclusive. Your program will need to track the number of resistances that are too high (>3.5 ohms), the number of resistances that are too low (=3 and 3.5) and the average resistance from those resistors that passed (the resistance of >= 3 and 0) should be included with the count of entered resistances. After the for loop output the batch name, the number of resistors that were in the batch, the numbers of resistances that were too low, the number of resistances that were too high and the average resistance of the resistors that passed. Use a do-while loop to evaluate another batch if the user indicates the he/she has another batch by entering a y (if there is another batch) or n (if there is not another batch). Between iterations of the do-while loop the number of resistors in the batch, the number of resistors that were too high, the number of resistors that were too low, and the average should be set to 0. Sample output is given below. Your code should not use any concepts beyond Chapter 5 of your textbook (e.g. arrays or programmer- built functions) or use any Boolean variables. Your code should employ a single string object to store the batch name and use descriptive (no single characters) for variable names. Remember to write appropriate conditions for all your loops. The while loops to check input should not contain any selection structures, instead the condition of the loop should check the input. Design your code minimize the number of relational expressions used. What is the name of the batch of resistors? Shadoe Batch 341 How many resistors are in Shadoe Batch 341? 9 Now enter the measured resistances for batch Shadoe Batch 341. Programming Project 2 CMPSC 201 - Spring 2020 Enter the resistance in ohms. 3.1 Enter the resistance in ohms. 2.999 Enter the resistance in ohms. 3.3 Enter the resistance in ohms. 3.50001 Enter the resistance in ohms. 3.5 Enter the resistance in ohms. 2.76 Enter the resistance in ohms. 3.2 Enter the resistance in ohms. 3.4 Enter the resistance in ohms. 3.0 There were 9 resistors in this batch. Of these 2 were below 3.00 ohms and 1 were above 3.50 ohms. The average of the 6 good resistors is 3.25. Do you have another batch to be analyzed (y)? y What is the name of the batch of resistors? Nails 87 ABC How many resistors are in Nails 87 ABC?-1 There must be at least 1 resistor in the batch. How many resistors are in Nails 87 ABC? 0 There must be at least 1 resistor in the batch. How many resistors are in Nails 87 ABC? 12 Now enter the measured resistances for batch Nails 87 ABC. Enter the resistance in ohms. 3.101 Enter the resistance in ohms. 2.99999 Enter the resistance in ohms. O The resistance cannot be zero or less. Enter the resistance in ohms. 3.0 Enter the resistance in ohms. 3.04 Enter the resistance in ohms. 3.05 Enter the resistance in ohms. 3.56 Enter the resistance in ohms. -1 The resistance cannot be zero or less. Enter the resistance in ohms. -11 The resistance cannot be zero or less. Enter the resistance in ohms. 3.17 Enter the resistance in ohms. 3.28 Enter the resistance in ohms. 3.39 Enter the resistance in ohms. 3.20 Enter the resistance in ohms. 3.41 Enter the resistance in ohms. 3.52 There were 12 resistors in this batch. Of these 1 were below 3.00 ohms and 2 were above 3.50 ohms. The average of the 9 good resistors is 3.18233. Do you have another batch to be analyzed (y)? n Problem: Create a program that will ask scientist in tracking the resistances of products from various batches. The resistances of good resistors should be between 3 and 3.5 inclusive. Your program will need to track the number of resistances that are too high (>3.5 ohms), the number of resistances that are too low (=3 and 3.5) and the average resistance from those resistors that passed (the resistance of >= 3 and 0) should be included with the count of entered resistances. After the for loop output the batch name, the number of resistors that were in the batch, the numbers of resistances that were too low, the number of resistances that were too high and the average resistance of the resistors that passed. Use a do-while loop to evaluate another batch if the user indicates the he/she has another batch by entering a y (if there is another batch) or n (if there is not another batch). Between iterations of the do-while loop the number of resistors in the batch, the number of resistors that were too high, the number of resistors that were too low, and the average should be set to 0. Sample output is given below. Your code should not use any concepts beyond Chapter 5 of your textbook (e.g. arrays or programmer- built functions) or use any Boolean variables. Your code should employ a single string object to store the batch name and use descriptive (no single characters) for variable names. Remember to write appropriate conditions for all your loops. The while loops to check input should not contain any selection structures, instead the condition of the loop should check the input. Design your code minimize the number of relational expressions used. What is the name of the batch of resistors? Shadoe Batch 341 How many resistors are in Shadoe Batch 341? 9 Now enter the measured resistances for batch Shadoe Batch 341. Programming Project 2 CMPSC 201 - Spring 2020 Enter the resistance in ohms. 3.1 Enter the resistance in ohms. 2.999 Enter the resistance in ohms. 3.3 Enter the resistance in ohms. 3.50001 Enter the resistance in ohms. 3.5 Enter the resistance in ohms. 2.76 Enter the resistance in ohms. 3.2 Enter the resistance in ohms. 3.4 Enter the resistance in ohms. 3.0 There were 9 resistors in this batch. Of these 2 were below 3.00 ohms and 1 were above 3.50 ohms. The average of the 6 good resistors is 3.25. Do you have another batch to be analyzed (y)? y What is the name of the batch of resistors? Nails 87 ABC How many resistors are in Nails 87 ABC?-1 There must be at least 1 resistor in the batch. How many resistors are in Nails 87 ABC? 0 There must be at least 1 resistor in the batch. How many resistors are in Nails 87 ABC? 12 Now enter the measured resistances for batch Nails 87 ABC. Enter the resistance in ohms. 3.101 Enter the resistance in ohms. 2.99999 Enter the resistance in ohms. O The resistance cannot be zero or less. Enter the resistance in ohms. 3.0 Enter the resistance in ohms. 3.04 Enter the resistance in ohms. 3.05 Enter the resistance in ohms. 3.56 Enter the resistance in ohms. -1 The resistance cannot be zero or less. Enter the resistance in ohms. -11 The resistance cannot be zero or less. Enter the resistance in ohms. 3.17 Enter the resistance in ohms. 3.28 Enter the resistance in ohms. 3.39 Enter the resistance in ohms. 3.20 Enter the resistance in ohms. 3.41 Enter the resistance in ohms. 3.52 There were 12 resistors in this batch. Of these 1 were below 3.00 ohms and 2 were above 3.50 ohms. The average of the 9 good resistors is 3.18233. Do you have another batch to be analyzed (y)? nStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started