Question
Problem 01: (Size of Data Types) Write a C++ program to print on screen the size in bytes of the following data types: Integer Long
Problem 01: (Size of Data Types)
Write a C++ program to print on screen the size in bytes of the following data types:
- Integer
- Long
- Double
- Char
- Boolean
Note that the output should be in the following format:
The size of x data type is y bytes
|
Problem 01 - Code:
|
Problem 01 - Output:
|
Problem 02: (Calculating percentage)
Suppose your monthly salary is 500 BHD. Based on the retirement policy, the employer must pay 19 percent for retirement of each employee. The employee contributes by 7 percent and the rest of the amount should be paid by the employer. Calculate the amount you and your employer will pay monthly for the retirement plan based on your monthly salary.
The output example:
My monthly salary: 500 BHD I pay (x %) BHD per month for retirement plan Employer Pay (y %) BHD per month for retirement plan
|
Problem 02 - Code:
|
Problem 02 - Output:
|
Problem 03: (Calculating discount)
Suppose a retail business sells an item that is regularly priced at 99.95 BHD and is planning to have a sale where the items price will be reduced by 22 percent. You have been asked to write a C++ program to calculate the sale price of the item. To determine the sale price, you perform two calculations:
First, you get the amount of the discount, which is 22 percent of the items regular price.
Second, you subtract the discount amount from the items regular price. This gives you
the sale price.
The output:
Regular price (BHD): 99.95 Discount amount (BHD): Sale price (BHD):
|
Problem 03 - Code:
|
Problem 03 - Output:
|
Problem 04: (Modulus)
Write a C++ program to convert 233 seconds to an equivalent number of minutes, and seconds.
Hint: You will need to use division and modulus.
The output:
233 seconds is equivalent to: Minutes: Seconds:
|
Problem 04 - Code:
|
Problem 04 - Output:
|
Problem 05: (Subtotal, Total and Vat)
A customer in a store is purchasing five items. The prices of the five items are
- Price of item 1 = BHD 15.95
- Price of item 2 = BHD 24.95
- Price of item 3 = BHD 6.95
- Price of item 4 = BHD 12.95
- Price of item 5 = BHD 3.95
Write a C++ program that holds the prices of the five items in five variables. Display each items price, the subtotal of the sale, the amount of VAT tax, and the total. Assume the VAT is 5%.
The output:
Item 1: BHD 15.95 Item 2: BHD 24.95 Item 3: BHD 6.95 Item 4: BHD 12.95 Item 5: BHD 3.95 Subtotal: BHD 64.75 Vat.: BHD 3.2375 Total: BHD 67.9875
|
Problem 05 - Code:
|
Problem 05 - Output:
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started