logo Hurry, Grab up to 30% discount on the entire course
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
William DewarComputer science
(5/5)

537 Answers

Hire Me
expert
Jayant KumarFinance
(/5)

512 Answers

Hire Me
expert
Abhishek MisraEconomics
(5/5)

546 Answers

Hire Me
expert
Herbert BarciaEducation
(5/5)

705 Answers

Hire Me
Others
(5/5)

You work in the vegetables\' section at the local grocery store. The store sells three vegetables - broccoli, onions and tomatoes.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Q2 (10 points)

You work in the vegetables' section at the local grocery store. The store sells three vegetables - broccoli, onions and tomatoes. 

The store manager updates the prices every morning. The cashier inputs the name of the item and the checkout computer display the 

price. You, as the IT guy, have to write a program (using conditionals) that displays the price of the item typed in. The cashier 

is a pretty careless dude and is not particular about capitalization and also makes frequent typos. Let's say, today's prices are 

$1.70, $2.39 and $3.21 per pound for broccoli, onions and tomatoes respectively. Make sure the program is written for the general 

case and the output is properly formatted.

 

Sample Output:

 

Enter the item being sold: BRoccoli

Price of broccoli is $1.70 per pound

 

Enter the item being sold: onIOns

Price of onions is $2.39 per pound

 

Enter the item being sold: cauliflower

Item not found

'''

 

price_broccoli = 1.7

price_onions = 2.39

price_tomatoes = 3.21

in_str = input("Enter the item being sold:")

if in_str.lower() == 'broccoli':

    print(f'Price of broccoli is ${price_broccoli:.2f} per pound')

elif in_str.lower() == 'onions':

    print(f'Price of onions is ${price_onions:.2f} per pound')

elif in_str.lower() == 'tomatoes':

    print(f'Price of onions is ${price_tomatoes:.2f} per pound')

else:

    print('Item not found')

'''

Q3 (10 points)

One Monday morning, your manager at the grocery store asks you to write a program where he can input the daily price for the vegetables 

every morning and get a print out in a nicely formatted fashion, as seen below. 

Use the f-strings method for at least one of the print statements.

 

Sample Outputs:

 

What is price of broccoli today: 1

What is price of onions today: 1

What is price of tomatoes today: 1

 

Vegetable Price Table

Broccoli        Onions          Tomatoes

----------------------------------------

$1.00           $1.00           $1.00 

 

What is price of broccoli today: 11.2

What is price of onions today: .56

What is price of tomatoes today: 39.3

 

Vegetable Price Table

Broccoli        Onions          Tomatoes

----------------------------------------

$11.20          $0.56           $39.30 

'''

price_broccoli = float(input('What is price of broccoli today:'))

price_onions = float(input('What is price of onions today:'))

price_tomatoes = float(input('What is price of tomatoes today:'))

 

print('\nVegetable Price Table')

print('Broccoli        Onions          Tomatoes')

print('----------------------------------------')

print(f'${price_broccoli:<15.2f}${price_onions:<15.2f}${price_tomatoes:<15.2f}')

'''

Q4 (10 points)

Ask user for an angle theta (in degrees), and output the following trignometric calculation:

sin(theta) * sin(theta) + 6*tan(theta). Remember that the argument for trignometric function must be in radians

 

Answer should be in four decimal places. 

 

Sample Output:

 

Enter the angle in degrees: 45

sin(theta) * sin(theta) + 6*tan(theta) = 6.5000

 

Enter the angle in degrees: 45.3

sin(theta) * sin(theta) + 6*tan(theta) = 6.5684

'''

 

import math

theta = (math.pi/180) * float(input('Enter the angle in degrees:'))

print(f'sin(theta) * sin(theta) + 6*tan(theta) = {math.sin(theta)*math.sin(theta)+6*math.tan(theta):.4f}')

sin(theta) * sin(theta) + 6*tan(theta) = 6.5684

'''

Q5 (10 points)

Ask the user for a starting and an ending integer and then output the square of all integers between them including the starting and

ending numbers. Use a for loop for this question. When trying out the code, be mindful that the output can get pretty long if the 

difference between the two input integers is large. To get full credit, the numbers should be in one line separated by a comma and a

space and ending with a period.

 

Sample Output:

 

Enter the starting number: 3

Enter the end number 9

9, 16, 25, 36, 49, 64, 81.

 

Enter the starting number: 5

Enter the end number 16

25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256.

'''

 

start_int = int(input('Enter the starting number:'))

end_int = int(input('Enter the end number'))

 

for i in range(start_int, end_int):

    print(i*i, end = ', ')

print(end_int*end_int, end = '.')

25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, 256.

(5/5)
Attachments:

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme