Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CIS 221 Programming Assignment Decisions Background: A new business needs a program to determine the net cost of a new phone they have designed, and

CIS 221 Programming Assignment

Decisions

Background:

A new business needs a program to determine the net cost of a new phone they have designed, and determine the expected profit based on sales price and total cost. They will also be selling this phone in India, China, and Europe so conversions of the net cost will also be required.

Instructions:

The input data will only be the phone name, sales price, and chipset (either Qualcomms Snapdragon 810 or Kirin 940) and which currency conversions the users wishes to do.

Start with a flowchart or pseudo code BEFORE you start to code. This document will be required prior to seeking professor help.

Input Validation

You will need to perform input data validation to make sure the user gives valid inputs. An appropriate message should be displayed if invalid data is entered. Here are the rules for data validation:

The phone name must begin with an alphabetic character. Other than that it can contain alphabetic characters, numeric digits, and spaces, but no other characters.

The sales price can contain a dollar sign, but other than that it must be numeric. Also, the sales price must be at least $100. It may include dollars and cents.

The chipset must start with either S or K. However, it doesnt matter whether the user enters upper case or lower case.

Calculating costs and profit

You need to perform the following calculations to determine costs of chipset, memory, camera, battery, and display. The sum of all these costs form the total cost of manufacturing the phone.

The chipset costs are calculated as follows:

Snapdragon costs 60% of sales price

Kirin costs 50% of sales price

However, its possible to get a Kirin discount

If they qualify the Kirin discount, the chipset cost is only 40% of sales price

In addition, the cost of memory is based on the sale price as follows:

For sales price at least $500, the memory cost is $100

For sales price at least $300 but less than $500, the memory cost is $90

For sales price less than $300, the memory cost is $80

Other expenses:

Camera (5% of Sales price)

Battery (Integer division by 22 of Sales Price)

Display (ASCII value of the first letter of the phone name)

Profit is calculated as sales price minus total costs.

NOTE: if the cost exceeds the sales price you must give the user a warning message to that effect.

Currency conversions

If there is a profit you can allow the user to specify whether to see the profit in foreign currency. Otherwise, dont give this option.

Prompt the user to indicate if they want to see Euros, Rupee, and/or Yen. They can answer yes, no, y, n, Y, N, etc. and your program must be flexible enough to handle any of these inputs.

Convert the net profit to the equivalent currency (.94 Euro per 1 USD; 67.06 Rupee per 1 USD; 112.82 Yen per 1 USD). The converted currency will be displayed rounded to 4 decimals -- but do NOT display the dollar sign for the converted amounts, (see note below). Both the net profit in USD and the converted currency will be included in a completed string for output. And for the currency conversion, it is possible to enter one, two or all three currency conversions and only those selected should be displayed.

Note: the following 3 are the escape sequence and hexadecimal Unicode representation to print the currency characters \u20AC, \u00A5, \u20B9. See Ch 3 book & slides for more information

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions