HomeWork On Chap-4
HomeWork On Chap-4
Submitted To:
Dr. Md. Ezharul Islam
Associate Professor
Dept. of CSE.
Jahangirnagar University.
Submitted By:
Shantanu Mazumder
Student Roll: CSE202101154
Jahangirnagar University
CSE, PMSCS.
Level 1 Programming Exercise:
6. Write a program that computes the total ticket sales of a concert. There are three types of
seatings: A, B, and C. The program accepts the number of tickets sold and the price of a ticket
for each of the three types of seats. The total sales are computed as follows:
Write this program, using only one class, the main class of the program.
9. Write a program that computes the area of a circular region (the shaded area in the
diagram), given the radii of the inner and the outer circles, ri and ro, respectively. We compute
the area of the circular region by subtracting the area of the inner circle from the area of the
outer circle. Define a Circle class that has methods to compute the area and circumference. You
set the circle’s radius with the setRadius method or via a constructor.
Output:
Level 2 Programming Exercise:
12. Write a program that displays the recommended weight (kg), given the user’s age and
height (cm). The formula for calculating the recommended weight is
Define a service class named Height and include an appropriate method for getting a
recommended weight of a designated height.
Development Exercise:
16. Write a program that accepts the unit weight of a bag of coffee in pounds and the number
of bags sold and displays the total price of the sale, computed as follows:
Define and use a programmer-defined CoffeeBag class. Include class constants for the price per
pound and tax rate with the values $5.99 per pound and 7.25 percent, respectively.
Answer: Source Code is given below:
Output: