Question: looking for an expert on Object-oriented Programming, please. It's about Programmer-defined Classes **please separate the questions with the question number** Question 4 (a) Define a

looking for an expert on Object-oriented Programming, please.

It's about Programmer-defined Classes

**please separate the questions with the question number**looking for an expert on Object-oriented Programming, please. It's about Programmer-defined Classes

Question 4 (a) Define a service class called Rectangle that has two floating-point data members, length and width. The class has a constructor to initialize data members, a method called perimeter( to calculate the perimeter of rectangle, and two methods called setLength() and setWidth( to set the dimensions of the rectangle (length and width) and a member method called describe Program() to explain the program to end user. (b) Write a main program to create one object from the above class and test all the method created in the class. Question 5 Write a program that accepts the unit weight of a bag of coffee in kilograms and the number of bags sold and displays the total price of the sale, computed as follows: totalPrice = bagweight * numberOfBags * pricePerkg; totalPriceWithTax = totalPrice + totalPrice * tax Rate; Define and use programmer-defined CoffeeBag class. Include class constants for the price per kilogram and tax rate with the values RM5.99 per kilogram and 7.25% respectively. Write a main program to create one object from the above class and test all the method created in the class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!