Sale!

CSC345 Lab01: “Revenue” Solved

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (4 votes)

Mission:
• To protect your program from suspicious activities.
• Attackers, thieves, invaders, and users acting smart will do every possible act to steal data and money, and
ruin your program.
Objective and points break down for each project:
• (10 points) To use welcoming and closing messages.
• (10 points) We work as a team, so we need consistent outputs. So your program should:
• Display the same exact messages been given in the demo.
• Watch out for the upper case and lower cases words.
• (10 points) Implement \n, \t, “ “, $ sign, and % sign as needed.
• (20 points) To use numerical calculations and Mathematical operations “+, -, *, /, %” to solve a reallife challenge.
• (20 points) To use if, and if-else statements.
• (20 points) To catch invalid numerical inputs (Negative numbers and Zeroes) without asking the user
to correct inputs.
• Users can enter numbers only.
• (E.g. assume users can only access the numpad section of the keyboard).
• Don’t worry about entering other inputs (e.g., Strings) rather than numbers for now.
• I mean don’t worry what would happen if the user enters a string, a char, or a
special characters instead of a number. We will discuss this later in another
chapter.
• In short, if user enters wrong data, don’t correct her, instead display an error
message and terminate the program.
• (10 points) To use exit(0) to end the program. To do so, add #include <stdlib.h>.
Instructions:
• Be sure to document your code (add comments on top of your C file). In the comments add your name,
date, course, homework number, and statement of problem.
• Once you are done, upload the single revenue.c file through D2L.
Project : revenue
Write a C program called revenue to calculate the revenue from a sale based on the unit price and quantity of a
product input by the user.
• The discount rate is
o 0% for the quantity purchased between 1 and 49 units.
o 10% for the quantity purchased between 50 and 99 units.
o 15% for the quantity purchased between 100 and 149 units.
o 25% for the quantity purchased greater than or equal150 units.
• Catch any invalid inputs (Negative numbers or Zeroes), output a warning message and end the program.
Case (1) a successful run:
Welcome to “RAMS” store
Enter item price: 10
Enter quantity: 60
The item price is: $10.0
The order is: 60 item(s)
The cost is: $600.0
The discount is: 10.0%
The discount amount is: $60.0
The total is: $540.0
Thank You for using “RAMS” store
Case (2) a failed run:
Welcome to “RAMS” store
Enter item price: -30
This is not a valid item price.
Please run the program again
Thank You for using “RAMS” store
Case (3) a failed run:
Welcome to “RAMS” store
Enter item price: 10
Enter quantity: -90
This is not a valid quantity order.
Please run the program again
Thank You for using “RAMS” store