[Solved] SOLVED:CS 3030 Scripting Languages – Lab 4: temp

30 $

File Name: SOLVED:CS_3030_Scripting_Languages_–_Lab_4:_temp.zip
File Size: 471 KB

SKU: [Solved] SOLVED:CS 3030 Scripting Languages – Lab 4: temp Category: Tag:

Or Upload Your Assignment Here:


Introduction Lab 4 is your first Python script and it is a simple one. It is interactive, meaning your script will promptthe user to enter a temperature in degrees Fahrenheit or Celsius and calculate the other, in a continuousloop until the user exits the program.RequirementsYour script shall be named ~/cs3030/lab4/temp and be marked executable. Here is how youexecute your script:./tempYour script shall interact with the user. The first thing it should print is exactly this:Welcome to the CS 3030 Temperature Conversion ProgramThis welcome message should be printed only once. Your program should then loop until the user enters “3” to exit the program. Your script should prompt theuser with this main menu: Main Menu1:Fahrenheit to Celsius2:Celsius to Fahrenheit3:Exit programPlease enter 1, 2 or 3:The user then enters 1, 2 or 3 (and hits ENTER)If the user enter “3”, the program exits.If the user enters a “1”, the user is prompted for degrees Fahrenheit with this prompt:Please enter degrees Fahrenheit:The user enters a number, which should not contain commas but can contain a decimal point or a minussign. Assume the user enters “56.2”. The program should respond with:1 of 4CS 3030 Scripting LanguagesLab 4: temp56.2 degrees Fahrenheit equals 13.4 degrees CelsiusThe program then reprints the main menu and prompts the user, in an endless loop.If the user enters a “2”, the user should be prompted for degrees Celsius with this prompt:Please enter degrees Celsius:The user enters a number as before, which should not contain commas but can contain a decimal point or aminus sign. Assume the user enters “91.8”. The program should respond with:91.8 degrees Celsius equals 197.2 degrees FahrenheitIf at any time the user enters anything non-numeric (including hitting just ENTER), your script should trapthe error and at a minimum, print a message that includes:Invalid entryYou should then reprint the main menu and start over at the beginning. Do not re-prompt for the degrees,start over at the top.Your script should include these two functions to calculate its results:def fahrenheitToCelsius(fahrenheit) – converts degrees fahrenheit to degrees celsiususing this formula: C = (F – 32.0) * (5.0/9.0)def celsiusToFahrenheit(celsius) – converts degrees celsius to degrees fahrenheit usingthis formula: F = (9.0/5.0) * C + 32.02 of 4CS 3030 Scripting LanguagesLab 4: tempHints• Use try/except to trap errors when prompting the user or converting the incoming string to a number• Always restart from the main menu when the user enters anything invalid• Always restart from the main menu after calculating degrees• Your script should expect the user to hit ENTER after each entry• Exit immediately when the user enters 3 from the main menu• Use whitespace and indenting to make your script readable• Add comments to your script to document your logicRun cucumber to determine your grade• Because temp is interactive, the first thing you should implement and test is typing 3 to exit. Thecucumber scripts rely on this feature and it must work.• The cucumber files for this lab implements a random number generator. To ensure your programalways produces the correct output, run cucumber multiple times.• When using cucumber, the tar command only needs to be run once (unless I update the cuke.tarfile and notify the class)tar xvf /var/classes/cs3030/lab4/cuke.tar./cucumber -sFilesFor this lab you will have created folder lab4 and the following executable files:temp3 of 4CS 3030 Scripting LanguagesLab 4: tempGradingHere is how you earn points for this assignment: FEATURES POINTS Must-Have FeaturesScript is named correctly and found in its proper place on icarus 5Script is executable 5Required FeaturesScript prints “Welcome to the CS 3030 Temperature Conversion Program” 5Script prints the Main Menu 5Script correctly converts degrees Fahrenheit to degrees Celsius with 1 decimalplace with option 110Script correctly converts degrees Celsius to degrees Fahrenheit with 1 decimalplace with option 210Script exits with option 3 10Script uses function fahrenheitToCelsius() 10Script uses function celsiusToFahrenheit() 10Script recovers from non-numeric entry at main menu 10Script recovers from non-numeric entry when prompting for degrees Fahrenheit 10Script recovers from non-numeric entry when prompting for degrees Celsius 10Grand Total 100

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] SOLVED:CS 3030 Scripting Languages – Lab 4: temp
30 $