(Get Answer)
Expert Answer
c++ project and need an explanation and answer to help me learn.
Requirements:
CSC121
Assignment#1
Due 2/20/2023 by 11:59 pm
100 Points
We do not use advanced concepts in any assignment. Only concepts learned weekly are applied. (So if there are students who know coding already, please make sure you do not use selection statements in this assignment. Focus on working with datatypes and arithmetic operators.) You may use the available math functions such as absolute.
Exercise#1 (25 Points)
Easter Sunday is the first Sunday after the first full moon of spring. To compute the date, you can use this algorithm, invented by the mathematician Carl Friedrich Gauss in 1800:
1. Let y be the year (such as 1800 or 2001).
2. Divide y by 19 and call the remainder a. Ignore the quotient.
3. Divide y by 100 to get a quotient b and a remainder c.
4. Divide b by 4 to get a quotient d and a remainder e.
5. Divide 8 * b + 13 by 25 to get a quotient g. Ignore the remainder.
6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h. Ignore the quotient.
7. Divide c by 4 to get a quotient j and a remainder k.
8. Divide a + 11 * h by 319 to get a quotient m. Ignore the remainder.
9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r. Ignore the quotient.
10. Divide h - m + r + 90 by 25 to get a quotient n. Ignore the remainder.
11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient.
Then Easter falls on day p of month n. For example, if y is 2001:
a = 6 g = 6 m = 0 n = 4
b = 20, c = 1 h = 18 r = 6 p = 15
d = 5, e = 0 j = 0, k = 1
Therefore, in 2001, Easter Sunday fell on April 15. Write a program that prompts the user for a year and prints out the month and day of Easter Sunday.
Exercise#2 (25 Points)
Write a program that reads in an integer and breaks it into a sequence of individual digits. For example, the input 16384 is displayed as
1 6 3 8 4
Make sure the input has no more than five characters and is not negative. (You don’t have to do this through code) Just make sure you enter correct data when running the program.
Sample Output:
Enter an integer: 16384
The digits extracted from integer 16384 are:
1 6 3 8 4
Exercise#3 (25 Points)
Write a program that reads two times in military format (0900, 1730) and prints the number of hours and minutes between the two times. Make sure the result is positive. Use arithmetic operators to accomplish everything such as the fact that there are 60 minutes and 24 hours.
Sample Output 1:
Please enter the first time: 0900
Please enter the second time: 1730
8 hours 30 minutes
Sample Output 2:
Please enter the first time: 1730
Please enter the second time: 0900
8 hours 30 minutes
Exercise#4 (25 Points)
Write a program that calculates and displays the take-home pay for a commissioned sales employee along with all of the deductions.
Input: Prompt the user for the weekly sales.
Process: Perform the calculations. The employee receives 8% of his or her total sales as his or her gross pay. His or her federal tax rate is 16%. He or she contributes 8% to his or her retirement program and 6% to Social Security.
Output: Display the results
Sample Output:
Enter Weekly Sales: 32000
Total Sales: 32000.00
Gross pay (8%): 2560.00
Federal tax paid: 409.60
Social security paid: 153.60
Retirement contribution: 204.80
Total deductions: 768.00
Take home pay: 1792.00
Pseudo Code:
Declare variables
Accept Input - weeklySales
Calculate Gross Pay = Weekly Sales * .08
Calculate Federal Tax = Gross Pay * .16
Calculate Social Security = Gross Pay * .06
Calculate Retirement = Gross Pay * .08
Calculate Total Deductions = Federal Tax + Social Security + Retirement
Calculate Total Take Home Pay = Gross Pay - Total Deductions
Display the following on separate lines and format variables with $ and decimal.
Total Sales Amount: value of weekly sales
Gross Pay (.08): value of gross pay
Federal Tax paid (.16): value of federal tax
Social Security paid (.06): value of social security
Retirement contribution (.08): value of retirement
Total Deductions: value of total deductions
Take Home Pay: value of take home pay
Note: Use Set Precision (2) to format the output. The statements should look something like the following:
//include the iomanip header file at the top of the file
#include
//use fixed and setprecision(2) to format the number
//use setw(8) to control the width of the field
//use \t to control the spacing between fields
cout << fixed << setprecision(2);
cout << "Gross Pay (0.08):\t $" << setw(8) << grossPay << endl;
Sample Rubric:
This question has already been tackled by one of our writers and a good grade recorded. You can equally get high grades by simply making your order for this or any other school assignment that you may have.
Every Student Buys Essays from us, here is why!
Pressed for time to complete assignments or when you feel like you cannot write, you can purchase an
essay on our website. Some students also want model papers to use as samples when revising or
writing. There are also students who approach our essay writing service to beat deadlines. We handle
every type of homework, assignment, and academic writing tasks. You can buy college essays and other
assignments here. At a glance, here are some reasons students prefer our website.
100% Original Essays and Papers
You can be sure that you are getting a paper that is custom written based on your instructions. We do
not sell papers that are pre-written. Instead, we write every essay from scratch. When you say “write my
essay,” we respond by giving you a paper that is 100% original and free of any plagiarism. The essays you
purchase from us have never been sold anywhere.
Flexible & Affordable Prices
It does not cost a fortune to get academic writing help on our website. If you have a question from class,
place an order, get a discount, and get cheap essay writing services. What you see as the price is what
you pay for. There are no any hidden charges. If you need urgent papers, they might cost a little more,
but the price is worth the quality you get in the end. Hire a professional academic writer beginning from
$13 a page.
Anonymity, Privacy, and Confidentiality
No one will ever know that you purchased an essay or assignment from our website. The essays you buy
from us are written by experts. Your data is only used to coordinate the essay writing services you get.
No one can access your personal information and data. Go ahead and order an essay from our website.
It is safe, secure, and convenient.