Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Problem: Create flowchart and pseudo code to do the following:- Modify week 4 assignmentto use input() function (no hard coded values) to prompt the user

Problem:

Create flowchart and pseudo code to do the following:-

Modify week 4 assignmentto use input() function (no hard coded values) to prompt the user to enter the values.

Make sure the prompt message is meaningful, do not say "Enter value", say something like this "Enter item name " after you get all the inputs, display the results and prompt the user if wants more calculation(add more items) (y/n). If no then print a message like "Thank you for ......."

The flowchart must include a loop, if-then and the total expenses.

WEEK 4 ASSIGNMENT

"""

Paul Johnson

ENTD200 B003 Spring 2023

Professor Smith

Week# 4

4/24/2023

"""

# Taking input values from user

shopper_name = input("Enter shopper name: ")

shop_name = input("Enter supermarket name: ")

shop_date = input("Enter shopping date (MM/DD/YYYY): ")

item_name = input("Enter item name: ")

item_price = float(input("Enter item price: "))

item_quantity = int(input("Enter item quantity: "))

commute_type = input("Enter commute type: ")

commute_fee = float(input("Enter commute fee: "))

# Calculating subtotal and total

sub_total = item_price * item_quantity

total = sub_total + commute_fee

# Printing details in neat fromat using format() method

print(" Shopper name:", shopper_name)

print(shop_name)

print(shop_date)

print("{:<20}{:<10}{:<13}{}".format('Item','Price','Quantity','Total'))

print("{:<20}{:<12.2f}{:<11}{:.2f}".format(item_name,item_price,item_quantity,sub_total))

print("Commute expense")

print("Commute type: {:<25}Fee: {:.2f}".format(commute_type, commute_fee))

print("{:<43}{:>5.2f}".format('Total expenses',total))

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

Students also viewed these Programming questions