Ask Java Expert


Home >> Java

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

Java, Programming

  • Category:- Java
  • Reference No.:- M92711619

Have any Question?


Related Questions in Java

Chatbotscreate a small networked chat application that is

Chatbots Create a small, networked chat application that is populated by bots. Introduction On an old server park, filled with applications from the early days of the internet, a few servers still run one of the earliest ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Applied software engineering assignment 1 -learning

Applied Software Engineering Assignment 1 - Learning outcomes - 1. Understand the notion of software engineering and why it is important. 2. Analyse the risk factors associated with phases of the software development lif ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

  • 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