Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

UNIX/LINUX #!/bin/bash read -p Enter name of City you live in: City read -p Enter the temperature of Monday: Monday read -p Enter

UNIX/LINUX

#!/bin/bash

read -p "Enter name of City you live in: " City

read -p "Enter the temperature of Monday: " Monday

read -p "Enter the temperature of Tuesday: " Tuesday

read -p "Enter the temperature of Wednesday: " Wednesday

read -p "Enter the temperature of Thursday: " Thursday

read -p "Enter the temperature of Friday: " Friday

read -p "Enter the temperature of Saturday: " Saturday

read -p "Enter the temperature of Sunday: " Sunday

let Total=$Monday+$Tuesday+$Wednesday+$Thursday+$Friday+$Saturday+$Sunday

let Average=$Total/7

echo "$City, $Total, $Average"

if [ $Average -ge 80 ]; then

echo "Summer"

elif [ $Average -lt 80 ] && [ $Average -gt 60 ]; then

echo "Spring"

elif [ $Average -le 60 ] && [ $Average -gt 50 ]; then

QUESTION

A) the above program prompts for how many days of the week to enter, then calculates the total and then the average as follows:

Get the city name and number of days to enter temperature for.

Compute total and average weekly temperature based on data entered for the week.

Display the city name, total, and average temperature.

Determine the season based on avg temp. using both if and CASE statements

NOTE: (A) is already Done.

I NEED HELP WITH THIS C and B

B) Use the SELECT control structure to prompt the user for the number of days in a week and perform the same function as in Part A using the SELECT technique.

C) Similar to Part B, use the FOR LOOP control structure to prompt the user for the number of days in a week and perform the same function as in Part A using the loop technique. You should let the user know, which day of the week being entered.

Note: You should do both SELECT and FOR loops separately.

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

101 Database Exercises Text Workbook

Authors: McGraw-Hill

2nd Edition

0028007484, 978-0028007489

More Books

Students also viewed these Databases questions