Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Create a flowchart or pseudo code BEFORE you start to code.

Input Validation

You will need to perform input data validation to make sure the user provides 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

Perform the following calculations to determine costs of chipset, memory, camera, battery, and display. The sum of all these costs is 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 sales 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, 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 use the most efficient approach to test for these values.

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. Allow the user to enter one, two or all three currency conversions; only those selected should be displayed.

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

Expected Program Behavior

Here are some example scenarios for testing your program:

Data validation failures:

Assuming good input (Kirin with no discount):

Asking the user if they qualify for a Kirin discount:

Assuming good input (Kirin with discount):

Assuming good input (Snapdragon):

NOTE: we dont ask about discount for Snapdragon, only for Kirin

Assuming good input (Snapdragon), but this time theres no profit:

NOTE: dont ask about currency conversion if theres no profit.

Program Requirements:

create a flowchart or pseudocode before you begin coding, use good programming techniques and comment your code to describe what it is doing.

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Advances In Databases And Information Systems 25th European Conference Adbis 2021 Tartu Estonia August 24 26 2021 Proceedings Lncs 12843

Authors: Ladjel Bellatreche ,Marlon Dumas ,Panagiotis Karras ,Raimundas Matulevicius

1st Edition

3030824713, 978-3030824716

More Books

Students also viewed these Databases questions

Question

What is the principle of thermodynamics? Explain with examples

Answered: 1 week ago

Question

Question Can a Roth IRA invest in stock of the IRA owners business?

Answered: 1 week ago