..
السلام عليكم جميعآ ..
سعيدهـ بتوآجدي في هذا المنتدى ..
لدلدي تكليف من الأستآذهـ .. وهي إنشآء برنآمجين ..
ولكل برنآمج تم تحديد المطلوب ..
لكن لم أفهمه ..
الرجآء التوضيح لي فقط .. مالمطلوب ( بالعربي )
وشكرآ مقدمآ ..
Exercise2:
Create a class called String (Note different capitalization). It has the following data members: value and length.
- Define a default constructor that initializes value to empty string and length to zero.
- Define a parameterized constructor that takes a string as parameter, set it to the member data value and set the member data length to the size of the member data value.
Hint: use the built in functions of class string
- Provide the appropriate set and get functions for the class data members if needed.
Finally, write a main function to test your class. And don’t forget to declare two objects using different constructor and print their information.
Sample output screen
Exercise 3:
Create product class. It contains name, price, discount percentage and price after discount as data members.
- Define a default constructor to initialize all data members.
- Define a member function that uses price and discount percentage to calculate and set the price after discount. Note that a member function can call another member function.
- Create a non member function displayInfo that receives the product from the main. Display all the object information and also print the price after discount.
- In the main let the user enters the product name, discount percentage and price. Next, set the product object with this information. Finally calculate the price after discount and call diaplyinfo().
Sample output screen
