Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Programming Assignment #3

Creating a Class

As seen on TV: "The National Collector's Mint allows you to own a piece of history with their recreation proof of the $50 Gold Buffalo Coin, the purest gold coin ever produced by the U.S. Government.

Because of a shortage of gold blanks, the U.S. Government had to stop production on the $50 Gold Buffalo Coin, resulting in skyrocketing prices among the latest edition. However, the National Collector's Mint has now released its nonmonetary tribute proof of the famous coin. Clad in pure 24K gold, the $50 Gold Buffalo Tribute Proof comes with an individually numbered Certificate of Authenticity. Only $9.95! (Plus shipping and handling)"

If you listen closely, you learn that each coin contains 14 milligrams of pure gold! Is that a deal or what? Let's create a class to find out.

I. Your "GoldDigger" Class

Create a class with these instance variables:

• The name of the coin
• The current price of gold, per ounce
• The selling price of the coin
• The shipping and handling charges, per coin
• The sales tax rate
• The amount of gold in the coin, in milligrams

Your class will have a constructor to initialize the instance variables, accessor (i.e. "get") methods to return the values of the instance variables, and a mutator (i.e. "set") method that updates the price of an ounce of gold.

Your class will have 2 additional methods:

1. A method that computes and returns the number of coins one would have to purchase in order to own one full ounce of gold

2. A method that computes and returns the premium (the extra amount you would pay) when buying one ounce's worth of coins (total cost of the number of coins computed by the above method, including S & H and sales tax) versus buying an ounce of gold.

Sales tax must be paid on the entire order for the coins, including the S & H, but not when buying the gold outright.

II. The Test Class

Now create a test class (aka: "client code") that uses the class you created above. In the main method you will

1. create an object

2. call the accessor methods to get the data and print it

3. get and print the number of coins (method 1., above)

4. get and print the premium (method 2., above)

5. modify the price of an ounce of gold

6. get and print the updated price of gold

7. get and print the new premium

III. Additional Specifications

1. All numeric instance variables must be type double

2. All output is to be done in the test class. None of the GoldDigger class methods does any output

3. The test class must call the accessor methods to get the data stored in the instance variables, and must call separate methods to compute and return the number of coins and the premium

4. Make sure all output is neatly presented and clearly labeled

5. Do not be concerned with the number of decimal places printed - we will soon learn how to control that

Although your program must work for any valid data, use this data in the run you hand in:

Name of the coin: $50 Gold Buffalo

Price of gold, per ounce: 1242.30

Selling price of the coin: 9.95

Shipping and handling charges: 4.95

Sales tax rate: 7.5%

Amount of gold in the coin, in mg: 14.0

Updated price of gold: 1655.50

IV. What to Upload to Moodle

Upload a zip file containing both classes and the program output

V. Due Date: Thursday, February 25th

Use 28.35 as the number of grams per ounce. There are 1000 milligrams in a gram.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91678341
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Suppose you are doing some online banking using your banks

Suppose you are doing some online banking using your bank's website. An attacker has set up an active wiretap between your computer and your bank's server. After checking your balance and reading through your transaction ...

Question suppose you roll a set of n dice then the smallest

Question : Suppose you roll a set of n dice. then the smallest sum is n and the largest is 6n. example if n=10 then the small sum will be 6 and the largest 60. Let m be the desired sum of the numbers rolled. then n Use a ...

A survey is taken of people in the class of favorite flavor

A survey is taken of people in the class of favorite flavor of ice cream among a forced choice of chocolate, vanilla, or strawberry. 70% prefer chocolate, 20% prefer vanilla, and 10% prefer strawberry. a) What is the ent ...

Please discuss the design principles that guide the authors

Please discuss the design principles that guide the authors of instruction sets in making the right balance. Provide examples of application of each of the three design principles while designing instruction sets.

Question when a syscall is called which register must have

Question : When a syscall is called which register must have the syscall number? Which syscall is a must for every program? Why?

I really do not know where to begin with this

I really do not know where to begin with this asignement. Activity Description A key aspect to planning is having an understanding of some of the layers involved in networks. This assignment examines a few of these layer ...

Case study 1 user interfacesearly user interfaces were

Case Study 1: User Interfaces Early user interfaces were designed with little or no consideration for the end user. This was largely due to technical and hardware limitations. The poor interface design required a specifi ...

A specialty software development firm is planning to offer

A specialty software development firm is planning to offer one of four new software products and wishes to maximize profit, minimize risk, and increase market share. If a weight of 65% is assigned to profit potential, 20 ...

Question suppose you want to perform two sums one is a sum

Question : Suppose you want to perform two sums: one is a sum of 10 scalar variables, and one is a matrix sum of a pair of two-dimensional arrays, with dimensions 10 by 10. What speed-up do you get with 10 versus 100 pro ...

The switch statementhere is the question in its entirety

The switch statement Here is the question in its entirety, but the actual problem is at the end. I just felt that I would give an overview of what I am asking. The program has to be in c++ (.cpp) and must compile as such ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As