EECS168 09:Homework4
| Navigation | 
|---|
| Home | 
| Information | 
| Classwork | 
Overview
By now you have learned how to write your own functions and make function calls. In this homework you will deal with function overloading. You are going to write a program to compute the total of the book purchases made by the student.
DUE DATE: The electronic submission of your homework must be received before 11:59 pm, Tuesday, 24th of February.
Problem Description
A book store sells books related to two fields namely, Maths and Biology. A Maths Major student will buy any two of the folllowing three books "Algebra", "Trigonometry" and "Calculus". A Biology Major student will buy any one of the following two books, "Botany" and "zoology". The book store offers a fixed discount on all the biology related books. You need to compute the Net total of the purchase made by the student depending on the major they belong to. The price listing of the books are as follows: "Algebra" = $100, "Trigonometry" = $90, "Calculus" = $80, "Botany" = $85, "Zoology" = $95.
Program Requirements
Name your source code file Sales.cpp. Your program should meet the following requirements:
- Declare five global constant variables for each of the five book prices and make use of these variables in the calculations.
 - In main() function, Read the Major of the student by a character. For "Maths" Major, user will input 'M' and for "Biology" major, user will input 'B'.
 - Write function RequestCourseName:
- Return Type: char
 - Parameters: None
 - This function is to read the course name. The courses are read with the first letter of the course(book) name.
 
 - Write function RequestDiscountPercent:
- Return Type: double
 - Parameters: None
 - This function is to read the discount in terms of percentage.
 
 - Write function calc_sale:
- Return value: Net_Total.
 - Return Type: double
 - This function is to compute the net total amount (deducting the discount, if any). You need to overload the function calc_sale,for both the cases (Maths Major and Biology Major).
 
 
Example Program Execution
- Enter the Major of the Student: M
 
- Enter the first letter of the course name: A
 - Enter the first letter of the course name: T
 - The total amount is: 190
 - Calculate for another purchase? (y/n): y
 
- Enter the Major of the Student: B
 
- Enter the first letter of the course name: B
 - Enter the discount allowed in percentage: 20
 - The total amount is: 68
 - Calculate for another purchase? (y/n): n
 
Note: In the above sample execution:
- In "Enter the Major of the Student: B", B refers to "Biology" Major.
 - And in "Enter the first letter of the course name: B", B refers to the course "Botany" (the first letter of the course)
 
Notes
- Your source code files should have comments at the top with:
- your name
 - the class ("EECS 168")
 - the assignment name (i.e., "Homework 4")
 - the date
 - an explanation of what the code is supposed to do
 
 - You should have comments in the code that explain what the code is doing.
 
Additional Requirements For EECS 169 Students
In addition to all the requirements for EECS168 students, students enrolled in EECS169 must also do the following:
- The program should test for all the possible invalid inputs and display the warning and prompt the user to input again:
- For example, Input for the Major can either be M (for Maths) or B (for Biology). All the other entries are considered as invalid.
 
 - Consider a discount of 10% on the total only if the student purchases Trigonometry and Calculus.
 
Submission
The files you should submit electronically (in a tarball) are:
- Sales.cpp: Your source code.
 - testing.txt: The testing you did on your finished program.
 
- The subject of your e-mail should be '[EECS 168] Homework 04'