Question
In an exam, students are given a set of questions and 1 point is awarded for every correct answer and 0.25 points are deducted for
In an exam, students are given a set of questions and 1 point is awarded for every correct answer and 0.25 points are deducted for every incorrect answer. Write a program PsLab3_1.cpp that prompts the user for the number of questions that the student answered correctly and the number of incorrect answers. The program should use a function calcMarkAsPercentage to calculate the students final mark as a percentage. Carefully consider the order of operations required to calculate the correct score and if you need to cast any values. Sample run: Enter the number of questions answered correctly: 6 Enter the number of questions answered incorrectly: 4 You mark is 50% 2. Write a program PsLab3_2.cpp to calculate the volume of spheres, cylinders and boxes. Your program should contain three functions, each called calcVolume and returning a double. The volumes should be calculated according to the following formulas: The volume of a box is its width multiplied by its height multiplied by its length. The volume of a sphere is 4/3 r3 where r is the radius of the sphere. The volume of a cylinder is r2
h, where r is the radius of the cylinder and h is the height of
the cylinder. Define a global constant PI and set its value to 3.14. Your program should ask the user which shapes volume they want to calculate, and get the required information. It should then call the correct calcVolume function and output the volume to the screen.
Step 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