首页 > > 详细

讲解留学生Prolog|讲解R语言编程|解析C/C++编程|讲解Python程序


This is a paired-programming assignment. You will work with a partner – each partner is expected to do an equal amount of work, from the planning (flowchart or pseudocode) to the final program.

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. The phone will sell in the United Kingdom, Ireland, and Sweden, so conversions of the profit will also be required.

Instructions:

Create a flowchart or pseudo code BEFORE you start to code – this will help you to think through the logic that you’ll use in the program. When seeking professor help on the assignment, you will need to produce and explain your logic/program plan.

You must present your pseudocode, in Microsoft Word, to me via Canvas by no later than Friday, May 25, 2018 – this is part of your grade. Your pseudocode must be submitted by one person in your group and in must include both names on it.

Input Validation

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

Validate input to make sure the user gives valid inputs. Display an appropriate message 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”, “s”, “k” or “K”. It doesn’t matter whether the user enters upper case or lower case, and it doesn’t matter if they enter the whole word or just the first letter, but your validation statement should only check against an upper case letter (for example, think about what you’ll do if the user enters “snap”).

Calculating costs and profit

Perform the following calculations to determine costs of chipset, memory, camera, battery, and display. The sum of these costs makes up 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, it’s possible to get a Kirin discount
If they qualify the Kirin discount, the chipset cost is only 40% of sales price

The cost of memory is based on the sale price as follows:
For sales price at least $500, memory cost is $100
For sales price at least $300 but less than $500, memory cost is $90
For sales price less than $300, memory cost is $80

Other costs:
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

Allow the user to specify whether to see the profit in foreign currency.

Prompt the user to indicate if they want to see Euros, Kronas, and/or Pounds. 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 (In your program comments identify the exchange rates you used on date you submited your final program 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, the user can select one, two or all three currency conversions; only those selected should be displayed.

NOTE: Use escape sequence and hexadecimal Unicode representation to print the currency characters. See Ch 3 book & slides for more information.


Expected Program Behavior

Here are some example scenarios for testing your program (however your program will use the currencies listed above):

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: don’t ask about discount for Snapdragon, only for Kirin

Assuming good input (Snapdragon), but this time there’s no profit:



NOTE: don’t ask about currency conversion if there’s no profit.

?
Program Requirements:


Your program file will be named LastnameLastnamePA3.py


For the rest of the course, you MUST create pseudocode before you begin coding, use good programming techniques (even if our book does not) and comment your code to describe what it is doing. Also, at the top of your code (beginning of the program), include the following comments and answer the question:


#Program name: XXXXXXXX
#Student names: Both partners’ names
'''Our submission of this program indicates that we have neither given or received unauthorized assistance in writing this program. '''
ANSWER THIS QUESTION as a comment in the program (required):
Programming is about solving problems. Which class activities have best helped you to sharpen your problem solving skills – in-class code exercises, code examples in book, MPL, end of chapter exercises, etc.


Deliverables:
One student in the pair will upload both the Python file and image or pdf of flowchart/pseudocode to Canvas by the due date/time
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!