0% found this document useful (0 votes)
65 views

CSC404 Assignment1

This document outlines two programming assignments for CSC404 Programming II. [1] The first assignment involves creating functions to calculate the area of a triangle and square based on user input dimensions. [2] The second assignment involves creating functions to display package details from a travel company and calculate total price based on package type and number of travelers, with a group discount for more than 5 travelers. Students must submit their algorithm, C++ program, and sample input/output by May 12th, 2022 for grading.

Uploaded by

adreana .z
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views

CSC404 Assignment1

This document outlines two programming assignments for CSC404 Programming II. [1] The first assignment involves creating functions to calculate the area of a triangle and square based on user input dimensions. [2] The second assignment involves creating functions to display package details from a travel company and calculate total price based on package type and number of travelers, with a group discount for more than 5 travelers. Students must submit their algorithm, C++ program, and sample input/output by May 12th, 2022 for grading.

Uploaded by

adreana .z
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

CSC404

PROGRAMMING II

Lab Assignment 1

I.Lab Assignment Requirements

a. Every assignment must have a comment header consists of the following:


/*
Name : Your full name
Sid# : Your student number
Course: CSC404
Group#:
Assign#:
Due Date: 12 May 2022 (12 midnight)
Program Description:
*/

b. Assignment Submission

Lab assignments are submitted in a form of softcopy (MS Words and .cpp)
which consists of:
 Algorithm
 C++ program
 Sample input and output

Completed assignments must be submitted on or before 12 May, 2022 in order to


receive full marks. This will contribute 5% of your assessment marks.

Late submission will be penalized.


Task 1: (5marks)

Create a program that has two functions name:

a) triangle ()

b) square ()

which can calculate the area of triangle and square respectively. Both functions receive parameters
length and width form user input and return the area for display.

Area for triangle and square can be calculated using equations below:

 Triangle = ½ (length x width)


 Square = length x width

The sample output of the program is shown in Figure 1.

Figure 1: Sample Output


Task 2: 10marks)

a. Write a function name DisplayPackage(). The function displays the package


details offered by Syarikat Percutian Era Sdn Bhd as shown in Table 1.

Package Type Traveler Price


Premium Kid RM59.60
Adult RM78.60
Economic Kid RM48.30
Adult RM62.50
Budget Kid RM39.00
Adult RM55.00
Table 1: Details of Package offered by Syarikat Percutian Era Sdn Bhd.

b. Write a function calcPrice(). The function calculates the amount if price to be


paid. The calculation for the total price is based on the package type selected and
number of traveler (kid and adults). Discount 5% is given to the order for a group of
more than 5 travelers with the same package type.

You might also like