Create the class appleproduct

Assignment Help JAVA Programming
Reference no: EM131883272

Programming Assignment

Introduction

iPhone X was announced on September 12, 2017 at the Steve Jobs Theater in the Apple Park campus in Cupertino. The device marks the iPhone's tenth anniversary, with X being used for the symbol 10. It eventually was released across the globe for purchase starting on November 3, 2017. With this product introduction, the AppleStore was selling iPhone X, iPhone 8, iPhone 8 Plus as well as Watch 1, Watch 3 and iPad and iPad Pro products in various color and memory configurations.

Task

Your assignment is to produce a two classes that work together to sell Apple products. In an effort to help you, the design of these two classes will be discussed here. In addition, some sample code has been provided to assist you with this task. Various UML diagrams are shown below to communicate the code you need to create. Please follow the steps outlined below and don't jump ahead until you have finished the earlier step.

Both of these classes must be part of namespace cs31.

First, you will create the class AppleProduct. This class represents a generic product sold by Apple Inc. Please review the class diagram shown here:

987_Class-Diagram.jpg

As designed, the class AppleProduct store two different strings, a double and an enumerated kind value. and provides accessor methods for each one. The Kind enumeration will need to be a public part of the class AppleProduct . The class diagram lists all the possible Kind value choices to be either NOTSPECIFIED, IPHONE, IPAD or WATCH. Create a .h and .cpp for this class. Write some sample driver code and assertions to verify that your accessor methods are all working properly. The AppleProduct class should accept whatever parameters are supplied to it. It should not perform any data validation and it should not incorporate the logic of the configuration tables shown above. It should just take the value of the passed arguments and place them into the class member variables.

The second class you will create is called AppleStore. A customer will use the AppleStore class to buy the particular AppleProduct they are interested in. Please review the class diagram shown here:

1856_Class-Diagram1.jpg

All of the public operations of AppleStore will validate the arguments supplied and then return an AppleProduct. The relationship between the class AppleStore and AppleProduct referred to as "creational pattern" and can be diagrammed in the following manner:

1958_AppleStore.jpg

Once you get to this point, there are seven remaining class methods to implement. Each are described below.

1. AppleProduct AppleStore::buyWatch1(string color);

This method should return a AppleProduct with the version set to "1", the kind set to WATCH, the color set to the string parameter passed here and the cost set to $249.00.

2. AppleProduct AppleStore::buyWatch3(string color);

This method should return a AppleProduct with the version set to "3", the kind set to WATCH, the color set to the string parameter passed here and the cost set to $329.00.

3. AppleProduct AppleStore::buyiPad( string color, int gigabytes );

This method should return a AppleProduct with the version set to "", the kind set to IPAD, the color set to the string parameter passed here and the cost set to either $329.00 or $429.00, depending on the gigabytes desired. Should the user pass an invalid value for the desired gigabytes, this method should throw a std::logic_error to communicate this failure back to the calling code.

4. AppleProduct AppleStore::buyiPadPro( string color, int gigabytes );

This method should return a AppleProduct with the version set to "Pro", the kind set to IPAD, the color set to the string parameter passed here and the cost set to either $649.00, $799.00 or $999.00, depending on the gigabytes desired. Should the user pass an invalid value for the desired gigabytes, this method should throw a std::logic_error to communicate this failure back to the calling code.

5. AppleProduct AppleStore::buyiPhone8( string color, int gigabytes );

This method should return a AppleProduct with the version set to "8", the kind set to IPHONE, the color set to the string parameter passed here and the cost set to either $699.00 or $849.00, depending on the gigabytes desired. Should the user pass an invalid value for the desired gigabytes, this method should throw a std::logic_error to communicate this failure back to the calling code.

6. AppleProduct AppleStore::buyiPhone8Plus( string color, int gigabytes );

This method should return a AppleProduct with the version set to "8Plus", the kind set to IPHONE, the color set to the string parameter passed here and the cost set to either $799.00 or $949.00, depending on the gigabytes desired. Should the user pass an invalid value for the desired gigabytes, this method should throw a std::logic_error to communicate this failure back to the calling code.

7. AppleProduct AppleStore::buyiPhoneX( string color, int gigabytes );

This method should return a AppleProduct with the version set to "X", the kind set to IPHONE, the color set to the string parameter passed here and the cost set to either $999.00 or $1,149.00, depending on the gigabytes desired. Should the user pass an invalid value for the desired gigabytes, this method should throw a std::logic_error to communicate this failure back to the calling code.

You are free to create additional public and private methods and data members as you see fit. However, the test cases will only be driving the public methods of the two classes diagrammed here. Please be certain to create these exactly as stated in this specifications.

The source files you turn in will these classes and a main routine. You can have the main routine do whatever you want, because we will rename it to something harmless, never call it, and append our own main routine to your file. Our main routine will thoroughly test your functions. You'll probably want your main routine to do the same. If you wish, you may write functions in addition to those required here. We will not directly call any such additional functions. If you wish, your implementation of a function required here may call other functions required here.

The program you turn in must build successfully, and during execution, no method may read anything from cin. If you want to print things out for debugging purposes, write to cerr instead of cout. When we test your program, we will cause everything written to cerr to be discarded instead - we will never see that output, so you may leave those debugging output statements in your program if you wish.

Attachment:- Assignment.rar

Reference no: EM131883272

Questions Cloud

What are the legal issues involved in this situation : What are the legal issues involved in this situation? What should the auditor use as a defense in the event that he is sued
Explain john chambers views about acquisitions : Explain John Chambers' views about acquisitions. How have his views affected the nature of Cisco's acquisition strategy?
Struggles with regard to a healthy body weight : What are the struggles with regard to a healthy body weight? Presenting explanations of concepts or methods to help fellow students
Prepare journal entries required to create warranty period : Spoiled Baby Corp (SPC) sells baby buggies. Prepare the Journal entries required to create and close the warranty period
Create the class appleproduct : you will create the class AppleProduct. This class represents a generic product sold by Apple Inc. Please review the class diagram shown here.
Assessment of the city : In a community health paper that is referring to a simulated city online, can I writer in a manner such as " Upon assessment of the city" or " I assessed"?
Determine which codes are ICD - CPT or HCPCS : HIM 215 Discuss how you will determine which codes are ICD, CPT, or HCPCS Identify some of the main terms you see in the patient record Identify any terms you
What incentives influence firms for international strategies : What incentives influence firms to use international strategies? What are the three basic benefits firms can achieve by successfully using an international.
Imbalance of power between a nation : What role did the imbalance of power between a nation like the U.S. and the Marshall Islands play in the decision to conduct nuclear tests there?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a sales tracking program named salestracking.java

create a sales tracking program named SalesTracking.java. This program must track monthly sales as well as compute average yearly sales, total sales for the year, and which month had the highest sales and which month had the lowest sales.

  Write a java program that calculates and displays the result

Write a Java program that calculates and displays the results of addition, subtraction, multiplication, division, modulus, bitwise &, or bitwise | operation on two integer values input by the user.

  Design and implement your own simple class to represent

Design and implement your own simple class to represent any household item of your choice (toaster, fan, hair dryer, piano ...) Your class should have a constructor, one additional method and at least one member variable (e.g. boolean isOn to turn th..

  Implement a recursive method that returns xn

implement a recursive method that returns xn - Suppose we want methods that compute the value of a double precision number raised to an integer power.

  Write a recursive method that converts a decimal integer

Write a recursive method that converts a decimal integer to a binary swing. Write a recursive method that converts a binary string to a decimal integer.

  Print the lyrics for ninety nine bottles of beer on the wall

Write a program that outputs the lyrics for "Ninety Nine Bottles of Beer on the Wall". Your program should print the number of bottles in English, not as a number.

  Square with a rectangle of the same size

Write a Java statement to initialize a variable square with a rectangle object whose top left corner is (10, 20) and whose sides all have length 40. Then write a statement that replaces square with a rectangle of the same size and top left corner ..

  Java program to demonstrate the use of jdbc

Write a Java program (non-GUI preferred) to demonstrate the use of JDBC. Write a list of animal and its characteristics to a database using JDBC

  Java program for a music social network system

Java program for a Music Social Network system. If you elect to work as a pair then equal marks will normally be given to both parties but the module leader reserves the right to reduce the marks for a contributor if it is clear there has been an i..

  Write a java program called numbers

Methods Lab   1. Write a Java program called Numbers that calls the following methods and displays the returned value: o Write a method called cubeIt that accepts one integer parameter and returns the value raised to the third power as an integer.

  Write a java code to count number of capital letters in line

Write a java codenpseudo-code to count the number of capital letters in a line of text. How many comparisons does it do? What is the fewestnumber of increments it might do? What is the largest number?

  Write a java program that revise the meanmedian class

Write a Java program that Revise the MeanMedian class so that the user can enter any number of values up to 20. If the list has an even number of values, median is the numeric average of the values in the two middle positions.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd