Explore BrainMass
Share

C++ Programs: Loops, Input Detection

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

Need programs that fulfill the requirements in attached document.

Write a method called check Value that will meet the following criteria:
- Initializes total both to the default initialization value.
- Get input for the starting number (assume important statement is already present)
- Set total to the input above.
- Utilize a counter controlled loop to loop 10 times.
- Increment total by 2 for each loop iteration
- Return True if total is greater than 50.
- Return False if total is less than or equal to 50.

Write a method called check Value that will meet the following criteria:
- Receives a character as an argument
- Utilizes a switch statement utilizing above character
- Prints >=90 if character is either a or A
- Prints 80-89 if character is either b or B
- Prints 70-79 if character is either c or B
- Prints 60-69 if character is either d or D.
- Prints <60 for all other characters.
- Method does not return anything

© BrainMass Inc. brainmass.com March 21, 2019, 5:02 pm ad1c9bdddf
https://brainmass.com/computer-science/cpp/problem-dealing-with-writing-a-program-206437

Attachments

Solution Preview

Please see the attachment.
(I write the two programs in C/C++)

// 206437_q1.cpp

#include <stdio.h>

bool checkValue() {
float total = 0.0; // Initialize total to a default value 0
float startNumber;

// Get input for the starting number
printf("Input a start number: ");
scanf("%f", &startNumber);

// Set total to the startNumber;
total ...

Solution Summary

Programs that fulfill specifications attached.

$2.19