r/pythonhelp • • Nov 06 '20

anyone tryna help me out, this stuff is tough

Objectives

In this program you will once again be developing a solution to solve a described problem. Many of the skills you called upon to finish previous work will be needed in addition to new skills such as

  • string manipulation

  • list structures and related commands

  • string formatting

  • string methods

Project Overview

This project will be an exercise to develop a similar but scaled-back solution as some of those mentioned in Historical Background above. You will be preparing code to process transactions that customers will be transmitting to The OneOh2 Company.

Information to be Provided

The OneOh2 company maintains a lot of information regarding their business. In this project, we will only be concerned about customer information and product information. This information will be provided to you in predefined lists that will be initialized as statements in the provided code for this program.

The following information will be provided for use in your program:

  • Customer Information:

    • Customer_Number

    • Customer_Name

    • Customer_Balance

    • Customer_Password

  • Product Information:

    • Item_Number

    • Item_Description

    • Item_Price

Note: All of the customer information and all of the product information lists are synchronized by index. As an example, the fifth item in each of the customer information lists pertains to the same customer.

Information to be Input

Your program will process input representing transactions from customers of The OneOh2 Company. Although there are different types of transactions you will need to process, your program will only need to process one transaction at a time. Through test cases in zyBooks, your program will be provided different transactions to process each time it is run.

The following types of transactions will be provided as input to your program:

  • Name change request

  • New password request

  • Customer order

A name change request and password change request will contain a single line of data. A customer order will contain an initial line of data followed by one or two item lines.

The format of the data input for each transaction type is discussed below. Note the column numbering and legend provided.

Name change request format

1 2 3 4 5 6 7

1234567890123456789012345678901234567890123456789012345678901234567890

NC#####NNNNNNNNNNNNNNNNNNNNNNNNN

where

  • "NC" is the two-digit code for this transaction type

  • ##### represents the customer number, and

  • NNNNNNNNNNNNNNNNNNNNNNNNN is the customer's new name in firstname middle lastname format

The following example:

NC03251Jimmy James Johnson

represents a name change for customer 03251 with the new name Jimmy James Johnson

Password change request format

1 2 3 4 5 6 7

1234567890123456789012345678901234567890123456789012345678901234567890

NP#####NNNNNNNNNN where

where

  • NP indicates the transaction type

  • ##### is the customer number

  • NNNNNNNNNN is the customer's new password

The following:

NP03251A%T^&j1

represents a password change for customer 03251 and a new requested password of A%T^&j1

Item order format

A customer item order will consist of data in two or three lines. The order will have one "header" record and one or two item records. The item order header format is

1 2 3 4 5 6 7

1234567890123456789012345678901234567890123456789012345678901234567890

CO#####NMMDDYYYY

where

  • CO indicates the transaction type

  • ##### is the customer number

  • N is the number of order lines (1 or 2, depending on whether order contains 1 or 2 item orders)

  • MMDDYYYY is the order date in monthdayyear format

The item order item detail data is in the following format:

quantity^item^MMDDYYYY

where

  • quantity is the quantity being ordered

  • item is the product/item number being ordered

  • MMDDYYYY is the requested date for the order

  • ^ is the separator character between data fields

The following example:

CO03251210182020

10^A2331^10232020

100^BDLS31234134^10252020

represents a complete customer order transaction for customer 03251 with 2 order lines, an order date of 10/18/2020 and one order line for quantity 10 of product A2331 on date 10/23/2020, and a second order line for quantity 100 of product BDLS31234134 on date 10/25/2020.

Processing / Output

General

Your program should be able to process any of the three transactions each time it runs. (You need to include appropriate input operations to get data from the user, however, due to the nature of this problem, you should not include any user prompt text as part of your input.) Because we have yet to do looping, your program does not need to process more than one transaction at a time. However, your program must recognize the transaction that is being requested and process accordingly.

Before doing any transaction processing, your program should do the following error checking on the provided data:

  • testing for valid customer number (does the customer number exist on the company's customer list?)

  • is the transaction type valid? This is the only error checking you need to do -- you may assume all other data provided will be valid

If the data is invalid, you should print one or both of the following messages:

  • Customer number ###### is invalid

  • Transaction type XXX is invalid After reporting one or both of these error messages, you should not do any further processing.

If both the customer number and transaction type are valid, you should continue processing based on the transaction type as described below:

Customer Name Change

From the customer name change transaction data provided,

  • construct a revised name in the format Last Name, First Name Middle (ex: Johnson, Jimmy James)

  • update the appropriate customer name

  • print the customer_name list (entire list, not individual item)

Customer Password Change

Evaluate the new password to see if it is secure according to the following rules:

  • At least 6 characters in length (not counting spaces)

  • Having the first four characters as follows:

    • first character an upper case letter

    • second character a lower case letter

    • third character a number

    • fourth character one of the following: !@#$%^&*()

    • (you do not need to check after the fourth character)

If the new password is not secure:

  • print the following message:

    • New password not secure. Request denied.

    • (No further processing is necessary)

If the new password is secure,

  • update the password in the customer data

  • print the customer_password list (entire list, not individual item)

Customer Item Order

As described above, you will have one or two order lines in a customer order. For each order line, you need to do the following:

  • look up the item number in the company product data (no "not found" error checking required)

  • use the price for that item to compute total cost for the item (quantity ordered x item price)

Once you have calculated the necessary information, then generate an invoice for the items. Your invoice should be in the format illustrated with the following example outputs. Note: the column numbering is to assist you with lining up output and should not be part of your actual output. Also, be sure your browser zoom is set to allow the entire window to be viewed or some text in the display may wrap.

1 2 3 4 5 6 7 8 9

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

Order Date: 10/21/2020

Customer: 29251 Costanza, George Louis

Ln# Item # Item Description Req Date Qty Price Total

1 BC571 Laser printer paper 11/21/2020 125 20.17 $ 2521.25

Total 2521.25

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

1 2 3 4 5 6 7 8 9

1 2 3 4 5 6 7 8 9

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

Order Date: 10/21/2020

Customer: 29251 Costanza, George Louis

Ln# Item # Item Description Req Date Qty Price Total

1 LO917 Pencils 11/21/2020 125 2.83 $ 353.75

2 IL993 Spiral notebooks 11/25/2020 235 23.08 $ 5423.80

Total 5777.55

1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890

1 2 3 4 5 6 7 8 9

0 Upvotes

0 comments sorted by