0% found this document useful (0 votes)
6 views2 pages

C++ Programming Tutorial: Resume & Calculations

The document outlines a tutorial on creating various C++ programs, including a resume generator, reversing digits, calculating costs with discounts and taxes, and managing orange plucking distribution. Each section provides specific user prompts and expected outputs for clarity. The tutorial is designed for educational purposes, focusing on practical programming applications.

Uploaded by

amirdanial703
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

C++ Programming Tutorial: Resume & Calculations

The document outlines a tutorial on creating various C++ programs, including a resume generator, reversing digits, calculating costs with discounts and taxes, and managing orange plucking distribution. Each section provides specific user prompts and expected outputs for clarity. The tutorial is designed for educational purposes, focusing on practical programming applications.

Uploaded by

amirdanial703
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

TutorialTopic 2(4)

SEQUENCE STRUCTURE

QUESTION

a. Create a resume using C++. Prompt the user to enter information from keyboard, then Display the
resume in an appropriate format. Example format has shown below:

Sample output:

MY RESUME

Personal Information

NAME : xxxxxxxxxxxxxx
Age : xx
Address : xxxxxxxxxxxxxxxxx

Education Background

Primary School : xxxxxxxxxxxxxxx


Secondary School : xxxxxxxxxxxxxxx
Higher School : xxxxxxxxxxxxxxx

Working Experience

1. xxxxxxxxxxxxxxxxxxxxx
2. xxxxxxxxxxxxxxxxxxxxx

b. Read four digits integer and display in reverse order.

Sample input and output:


Enter 4 digits number:
6
2
5
1
The number in reverse order is 6 2 5 1

c. Read a four digit number and display in reverse order.

Sample input and output:


Enter 4 digits number: 7546
The number in reverse order is 6457

Ms Maznie Manaf, FSKM


d. Write a program that prompts the user for:
 Cost per item
 Number of item purchased
 Discount rate

The program should then calculate and display the:


 total cost
 Total cost after discount
 Tax due
 Amount due

Assume Tax rate is 6%

Use the formulas:


 Total cost = number of items * cost per item
 Total cost after discount = total cost – (discount rate * total cost)
 Tax due = total cost after discount *tax rate
 Amount due = total cost after discount + tax due

*The result must be display in an appropriate receipt format.

e. Write a C++ program that asks the user to enter a number of 10 cents and a number of 50 cents syilling.
The program will calculates and output the total of cents entered.

Sample output
Enter a number of 10 cents: 10
Enter a number of 50 cents: 3

Total cents: 250


Total RM: 2.50

f. Four workers were responsible to pluck oranges. The owner of the orange farm will be given 40% of
the oranges. The workers share equally the balance of the oranges. The balance of oranges after
divided will be used to make juice. Write a complete program that accepts input for the amount of
oranges that were plucked. You are also required to calculate and print amount of oranges that were
received by the owner, each of the workers and balance of oranges to make juice.

Sample output:
Enter number of oranges plucked : 125
Total oranges for the owner is 50
Total oranges for each worker is 18
Balance of oranges to make juice is 3

Ms Maznie Manaf, FSKM

Common questions

Powered by AI

To calculate the total value in RM from quantities of 10 cents and 50 cents coins, the program should take the number of each type of coin as input using `cin`. Calculate the total cents by multiplying the number of 10 cent coins by 10 and then the number of 50 cent coins by 50. Add these two to get the `Total cents`. Convert this total into RM by dividing the total cents by 100 to get the `Total RM`. Use `cout` for output, displaying both the total cents and equivalent RM amount. This requires basic arithmetic operations and understanding of currency calculation.

To create a program that reverses a four-digit number, first prompt the user to enter the number using `cin`. Convert this number into a string or an array of characters, allowing each digit to be manipulated individually. You can either manually reverse the array or use the `std::reverse` function. Finally, convert the reversed char array back into an integer type if needed, and display the reversed number using `cout`. This involves understanding user input handling and basic array operations in C++.

To calculate financial amounts in a C++ program, begin by accepting inputs for cost per item, number of items purchased, and discount rate using `cin`. Use floating-point variables to handle potential decimal values precisely. Compute the 'Total cost' by multiplying the cost per item with the number of items. Apply the 'Discount' to find 'Total cost after discount', then use a fixed tax rate (6% here) to calculate the 'Tax due'. Finally, sum the discounted amount and the tax to find the 'Amount due'. Use `cout` to display all computed values in a formatted receipt-like structure. This computation sequence involves arithmetic operations and understanding order of operations in programming.

To distribute plucked oranges in C++, first input the `total number of oranges` plucked using `cin`. Calculate the owner’s share by multiplying the total by the owner's percentage share (40%). The remainder of the oranges, obtained by subtracting the owner's share from the total, is shared equally among workers. Use the integer division for equal distribution among workers, and the modulus operation to determine leftover oranges for juice. Utilize `cout` to display the owner's share, worker's individual shares, and the leftover oranges clearly. This involves programming logic for distribution using division and modulus operations.

To design a C++ program for creating and displaying a resume, begin by defining variables for personal information such as name, age, address, education background, and work experience. Use `cin` to prompt the user for these inputs. Store each entry in the respective variables. Next, to display the resume, use `cout` to print each section clearly, following a structured template similar to the example provided. This will involve methods like `std::setw` for aligning the text properly, ensuring the output is user-friendly and easily readable. Format the resume with clear labels and values for each section, such as 'NAME:', 'AGE:', etc., followed by the corresponding user inputs.

You might also like