Define a function PrintValue() that takes two integer parameters and outputs the sum of all integers starting with the first and ending with the second parameter, followed by a newline. The function does not return any value.
Ex: If the input is 1 4, then the output is:
10
Note: Assume the first integer parameter is less than the second.
Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 2, print "Too small". If greater than 10, print "Too large". Otherwise, compute and print 6 * bagOunces followed by " seconds". End with a newline. Example output for ounces = 7:
42 seconds
Define a function CalcPyramidVolume() with double data type parameters baseLength, baseWidth, and pyramidHeight, that returns as a double the volume of a pyramid with a rectangular base. CalcPyramidVolume() calls the given CalcBaseArea() function in the calculation.
Relevant geometry equations:
Volume = base area x height x 1/3
(Watch out for integer division).
Define stubs for the functions called by the below main(). Each stub should print "FIXME: Finish FunctionName()" followed by a newline, and should return -1. Example output:
FIXME: Finish GetUserNum()
FIXME: Finish GetUserNum()
FIXME: Finish ComputeAvg()
Avg: -1
Write a function so that the main() code below can be replaced by the simpler code that calls function MphAndMinutesToMiles(). Original main():
int main() {
double milesPerHour;
double minutesTraveled;
double hoursTraveled;
double milesTraveled;
cin >> milesPerHour;
cin >> minutesTraveled;
hoursTraveled = minutesTraveled / 60.0;
milesTraveled = hoursTraveled * milesPerHour;
cout << "Miles: " << milesTraveled << endl;
return 0;
}
Define a function PrintFeetInchShort(), with int parameters numFeet and numInches, that prints using ' and " shorthand. End with a newline. Remember that outputting 'endl' outputs a newline. Ex: PrintFeetInchShort(5, 8) prints:
5' 8"
Hint: Use \" to print a double quote.
Create a new project, and copy your
code from Task 1 to the new project
(copy the contents of the Main()
method and the displayDetails()
method)
Adapt your Main() method to capture
and display the details for 4 different
people.
The displayDetails() method
should remain unchanged.
Create three sub classes namely: programmer, admin and librarian to store bonus,
overtime and total salary for each employee
5) Each of the constructor in (4) should inherit the properties of Employee(using the super
keyword) and implement the EmployeeSalary interface.
6) Hide the properties from the parent class Employee using encapsulation principle.
7) Use getters and setters to make the properties in Employee visible and accessible to other
CASE STUDY: A PAYROLL SYSTEM
In this project, students are to use Java to develop a payroll software to assist in paying the salary
of employee/staff of a certain university named XYZ University. Assume we have three employees
in the university with ranks - Programmer, Admin and Librarian, write a Java program to calculate
and printout the total salary of these three employees in the institution. The program should have
the following features:
1) Create a public class named: Employee that would get the firstname and lastname of each
employee from the keyboard/user
2) Create three objects: prog, adm and lib, for programmer, admin and librarian respectively to
access the properties in Employee class.
3) Create EmployeeSalary as parent interface to store basic_sal, housing_all and
transport_all. The values for these three items are fixed for all Employee and has abstract
function calculateSalary.
MOV AX, 05ABH
MOV AL, 34H
ADD AH, A5H
MOV BX, 0000H
MOV BL, AH
MOV BH, AL