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

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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