Adjust the code you wrote for the last problem to allow for weighted classes. Add a parameter weighted (1 = yes, 0 = no) and then return the correct number for the GPA. Weighted classes get one extra point on the GPA value.
Input: Letter GradeExpected output: Non-weighted GPA valueExpected output: Weighted GPA valueA45B34C23D12F01Anything elseInvalidInvalid
Enter your Letter Grade: B
Is it weighted? (1 = yes, 0 = no) 1
Your GPA score is : 4Enter your Letter Grade: B
Is it weighted? (1= yes, 0= no) 0
Your GPA score is: 3Enter your Letter Grade: a
Is it weighted?(1 = yes, 0 = no) 0
Your GPA score is : 4Templates and Exception Handling
Implement a Class Template Queue data structure for queue operations such as Full() and Empty() with exception handling. Note: Use templates with exception handling and size of queue is set to 5.
Print: "An queue overflow exception occurred!" or "An queue empty exception occurred!"
Templates and Exception Handling
Design simple class BankAccount. If amount to be withdrawn is greater than balance, throw “Insufficient Balance” exception.
Templates and Exception Handling
Design a template function for swapping the int, double and char type values between two variables. Note: Use function overloading.
run time input
10
35
In order to separate patients who are likely infected with the novel corona virus (COVID-19) from other patients, Fafagh clinic Records the temperature of all patients before triaging. According to a new policy of the clinic, the number of patients allowed should not exceed one hundred (100) in day. The policy also stipulates that a patient should be considered for a malaria test when his/her temperature is between 38 degree Celsius and 40 degree Celsius.whilst a patient whose temperature is above 40 degrees Celsius should undergo the Covid 19 test. Although the thermometer used to record the patient’s temperature is calibrated in Fahrenheit, the chart recommended by the policy for determining the test required (malaria/ Covid 19) is specified in Celsius.
1.Draw a flowchart for the above problem
2. Write a program in C++ programming language that:
Give an example of a "while" loop, then provide the equivalent "do-while" loop and "for" loop. Then give a different example of a do-while loop, along with the equivalent while loop and for loop. Finally, give an example of a for loop, along with the equivalent while loop and do-while loop.
A teacher has asked all her students to line up according to to their first name. For example, in one class Amy will be at the front of the line and Yolanda will be at the end. Write program that reads the number of students and their names from a file. Once all the names have been read, it reports which student would be at the front of the line and which would be at the end of the line.
Write a program that produces the following output using nested for loops.
****** ///////////// ******
***** ///////////\\ *****
**** /////////\\\\ ****
*** //////\\\\\\\ ***
** ////\\\\\\\\\ **
* //\\\\\\\\\\\ *
\\\\\\\\\\\\\
Write a program that reads a word and prints all sub strings sorted by length. For example, if the user enters the word ”cat”, the program prints
c
a
t
ca
at
cat
*Based on answer choices A-E, what is the code's output?
10. Given the following code, the output is __.
class Apple
{
int i;
Apple(int n) { i = n; }
}
class Sample
{
int j;
private Sample()
{
Apple a1 = new Apple(2);
a1.i++;
j = a1.i;
}
public static void main(String args[])
{
Sample s1 = new Sample();
System.out.println(s1.j);
}
}
A. 5
B. 4
C. 3
D. 2
E. 1