Students in Computer Science would like to understand the concept of Ohm’s law. You are required to write an application that will allow them to calculate the relation between Voltage, Current and Resistance using the formulas below.
V = IR, Current (I) = V/R, Resistance= V/I, (where I is the current, V - Voltage and R is the resistance). The program must do the following:
Prompt the user for the calculation he/she would like to see or N/n to exit .
Based on the option selected by the user (I/I, V/v, R/r),
If an invalid option is selected an appropriate error message must be displayed.
NB: Use a switch for the selection If there are no calculations to performed, display a summary that consist of the number of calculations performed. This number must exclude the invalid options,
Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.
1.Mix the for loop with a do-while
Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.
1.Use a nested for loop to determine the answer.
Write an algorithm that will accept the following for 100 students: The students’ name (studName) and 3 test marks (marks), as well as one exam mark (examMark). The program must calculate the final mark (finMark) for every student. The final mark comprises of 50% of the exam mark added to 50% of the average (agv) of the 3 tests. Display the final mark for every student.
1. Use a simple for-loop to determine the answer.
The user must enter a positive integer between 5 and 15. If this number is valid, the user must also choose between a triangle (T or t) and a square (S or s). Display suitable error messages if necessary; otherwise, the program must use an asterisk to draw a triangle or a square of the chosen size and display. Use a Select Case structure to make the decision. Display appropriate error messages where applicable.
Do the necessary planning (IPO) and write an algorithm in pseudo code for the following:
1 An unknown number of toddlers are taking part in a competition. 5 adjudicators will give each competitor a mark out of 10. These marks are added together to get a mark out of 100. Write a complete C++ program to do the following
Enter the competitor’s number. ( -1 is entered to terminate the input).
Enter 10 marks out of 10 for each competitor.
Calculate the total mark.
Compare it to the marks of previous competitors to obtain the highest mark.
Enter the number of the following competitor.
When all data have been processed, display the number of the competitor with the highest mark as well as the current competitor’s mark.
Write a C++ program that will read in, for 20 employees, their employee number and the number of days absent for the year. You must then determine and display the following:
1. The employee numbers of all the employees who were not absent at all during the year.
2. The average number of days of absence for the year, and
3. The employee number of the person with the most days absent.
Write an application that ask the user for a letter grade A, B, C, D, E, or Q to quit. When the user types the user Q the program must end. Display the following using the information on the table below. Use a switch statement for the selection. When the loop terminates display how many A, B, C, D, or E were entered.
Grade Message
A Excellent
B Very Good
C Good
D Fair
E Poor
You are required to build a class to represent the a cup of coffee. Call your class
CoffeeCup. A coffee cup will have following characteristics
1. type (sting) // can be mocha, cupaccino, etc
2. temperature (float): represents the measure of
temperature in degrees
3. volume (float):// the volume of coffee in the cup in ml
liters
4. sugar (int):// no of teaspoons of sugar added to the coffee
5. bool hasMore(): //this method checks if the cup has coffee in it that a person can take a sip
from. For the implementation assume that one sip consumes a volume of 0.3 ml. So you will do
some calculations in this method to check if it has any sips left depending upon the volume
available.
6. bool isEmpty(): // returns true if a person can take a sip from this cup and false otherwise
7. bool takeASip():// this method represents the actual act of sipping. One sip is taken i.e. the
volume equivalent to one sip is taken away.
8. Provide a method print, that displays the status of the cup with respect to all data members.