Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

java 1. Add a copy constructor to the Bank Account class. This constructor should accept a bank account object as an argument. it should assign

java

1. Add a copy constructor to the Bank Account class. This constructor should accept a bank account object as an argument. it should assign to the balance field the value in the argument's balance field. As a result ,the new object will be a copy of the argument object.Use 6% for state tax and 1% for county tax - sample data: 5000 in sales results in 300 in state tax and 50 in county tax.

2. The westfield carpet company has asked you to write an application that calculates the price of carpeting for rectangular rooms. To calculate the price ,you multiply the area of the floor(width times length) by the price per square foot of carpet. For example ,the area of the floor that is 12 feet long and 10 feet wide is 120 square feet. To cover that floor with carpet that costs $8 per square foot would cost $960.(12*10*8=960)

First,you should create a class named RoomDimension that has two fields:one for the length of the room and one for the width. The RoomDimension class should have a method that returns the area of the room.(The area of the room is the room length multiply by the room's width).

Create a RoomCarpet class that has a RoomDimension object as a field.it should also have a field for the cost of the carpet per square foot. The RoomCarpet class should have a method that returns the total cost of the carpet.

Once you have written this classes,use them in an application that asks the user to enter the dimensions of a room and the price per square foot of the desired carpeting.The application should display the total cost of the carpet.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions