Question: i need to solve this please . Lab 02: Object Oriented programming Objectives: Building Blocks Class attributes accessors and mutators Extracting relevant data and functions

i need to solve this please .  i need to solve this please . Lab 02: Object Oriented
programming Objectives: Building Blocks Class attributes accessors and mutators Extracting relevant data

Lab 02: Object Oriented programming Objectives: Building Blocks Class attributes accessors and mutators Extracting relevant data and functions from paragraphed written problem 1. Exercise: Invoice class Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An Invoice should include four pieces of information as instance variables-a part number (type String), a part description(type String),a quantity of the item being purchased (type int) and a price per item (double). Your class should have a constructor that initializes the four instance variables. Provide a set and a get method for each instance variable. In addition, provide a method named getInvoice Amount that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as a double value. If the quantity is not positive, it should be set to 0. If the price per item is not positive, it should be set to 0.0. Write a test application named Invoice Test that demonstrates class Invoice's capabilities. II. Exercise: Date class Create a class called Date that includes three pieces of information as instance variables-a month (type int), a day (type int) and a year (type int). Your class should have a constructor that initializes the three instance variables and assumes that the values provided are correct. Provide a set and a get method for each instance variable. Provide a method displayDate that displays the month, day and year separated by forward slashes(/). Write a test application named DateTest that demonstrates classDate's capabilities. 2020/2021 Umm Al-Qura university Computer & Information Systems college Instructor: Dr. Aymen M. Akremi III. Exercise : SavingAccount Create class Savings Account. Usea static variable annuallnterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has ondeposit. Provide method calculateMonthlyInterest to calculate the monthly www.oumstudents.tk interest by multiplying the savings Balance by annualinterestRate divided by 12 this interest should be added to savings Balance. Provide a static method modifyinterestRate that sets the annuallnterestRate to a new value. Write a program to test class SavingsAccount Instantiate two savings Account objects, saveri and saver2, with balances of $2000.00 and $3000.00, respectively. Set annuallnterestRate to 4%, then calculate the monthly interest and print the new balances for both savers. Then set the annuallnterestRate to 5%, calculate the next month's interest and print the new balances for both savers

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!