Question

Instructions Instructions Download the two attached files. TestFahr2Cel.bat is a batch file that tests the Fahr2Cel.py program. It uses the echo command. The echo command simply echos what ever follows it to standard out. So echo 212 | Fahr2Cel.py will send the 212 as input to the Fahr2Cel.py program The of keyword is special to echo. The first line, echo o tells he batch processor not ech the command et e executin ? the This s not necessar tust make the output look cleaner. 1) With the downloaded files in the same folder, open a CMD window and cd to that folder. Execute the batch file by typing Farh2Cel.bat at the prompt. You may need to change the Shebang line # to the location of your python interpreter. Study how the test program works, and play with changing t a bit. 2) Write a test program for your Morse program. Test at least three cases: a one word input, a phrase with single-letter words likeI or a, and a very long sentence that word- wraps to the next line. Call your program testMorseCode.bat submit it to Sakai. 3) Write a test program for the LeapYear program under the Decisions Structures lab. Test all paths through the program to verify it handles every case correctly. Call your program testLeapYear.bat - submit it to Sakai You should have two files submitted Additional resources for assignment estFahr2Cel.bat (1 KB; Dec 10, 2017 2:05 pm) Fahr2Cel.py.(1 KB; Dec 10, 2017 2:05 pm)

THE ATTACHMENTS:( needed to solve the problem above)

(1) My Morse Code Program:

#03/22/2018
#Creating a program that translates sentences in to morse code

def main():
  
morsecode_dict={}   
line=""  
f1 = open("MorseCode.txt",'r');
  
content = f1.readlines()
  
for x in content:
#print x
x=x.split()
my_dict[x[0]]=x[1]

print (morsecode_dict)
  
val=raw_input("Enter a String value: ")
val.upper()
output=""
  
for i in val:
print (i.upper())
if(i!=' '):
output = output + morsecode_dict[i.upper()]+' '
else:
output = output+'\n'

print ("-----Morse Code of The Given Sentence----- \n",output)


main()

(2) My leap year Program

#prompt user for a year
year = int(input("Enter a year: "))

#process year to see if divisible by 4 or, if a century, divisible by 400
if (year % 4 == 0 and year % 100 != 0) or (year % 400 == 0):
print "The year", year, "is a leap year"
else:
print "The year", year, "is not a leap year"

(3) testFahr2Cel.bat (won't let me upload files so copy and paste below)

        echo off
        echo "Testing Fahr2Cel.py program"
        echo.
        echo "Enter 212F, answer should be 100C"
        echo 212 | Fahr2Cel.py
        echo.
        echo "Enter 32F, answer should be 0C"
        echo 32 | Fahr2Cel.py
        echo.
        echo "Enter -40F, answer should be -40C"
        echo -40 | Fahr2Cel.py

(4) Fahr2Cel.py (won't let me upload files so copy and paste below)   

#!C:\Users\974student\AppData\Local\Programs\Python\Python35-32\python.exe
# Converts Fahrenheit to Celsius
# 2/10/2015

#input
fahrenheit = input('Enter temperature in Fahrenheit: ')
fahrenheit = float(fahrenheit)

#processing
celsius = (fahrenheit - 32.0) * 5/9

#output
print ('The temperature in Celsius is', celsius)
0 0
Add a comment Improve this question Transcribed image text
Answer #1

If you have any doubts, please give me comment... I will help you...

morseCode.py

#03/22/2018
#Creating a program that translates sentences in to morse code

def main():
  
morsecode_dict={}   
line=""  
f1 = open("MorseCode.txt",'r');
  
content = f1.readlines()
  
for x in content:
#print x
x=x.split()
morsecode_dict[x[0]]=x[1]

    print (morsecode_dict)
  
val=raw_input("Enter a String value: ")
val.upper()
output=""
  
for i in val:
if(i!=' '):
output = output + morsecode_dict[i.upper()]+' '
else:
output = output+'\n'
print ("-----Morse Code of The Given Sentence----- \n",output)


main()

only this program is getting error. I modified the code... rest of programs correct... you can use as it is...

[anunagananunaga 10042018]$ python morseCode.py 0 Enter a String value: ABC ( Morse Code of The Given Sentence \n [anunaga@a

MorseCodes.txt

A .-
B -...
C -.-.
D -..
E .
F ..-.
G --.
H ....
I ..
J .---
K -.-
L .-..
M --
N -.
O ---
P .--.
Q --.-
R .-.
S ...
T -
U ..-
V ...-
W .--
X -..-
Y -.--
Z --..
0 -----
1 .----
2 ..---
3 ...--
4 ....-
5 .....
6 -....
7 --...
8 ---..
9 ----.

Add a comment
Know the answer?
Add Answer to:
THE ATTACHMENTS:( needed to solve the problem above) (1) My Morse Code Program: #03/22/2018 #Creating a...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program Description: A Java program is to be created to produce Morse code. The Morse code...

    Program Description: A Java program is to be created to produce Morse code. The Morse code assigns a series of dots and dashes to each letter of the alphabet, each digit, and a few special characters (such as period, comma, colon, and semicolon). In sound-oriented systems, the dot represents a short sound and the dash represents a long sound. Separation between words is indicated by a space, or, quite simply, the absence of a dot or dash. In a sound-oriented...

  • PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program tha...

    PLEASE WRITE CODE FOR C++ ! Time Validation, Leap Year and Money Growth PartA: Validate Day and Time Write a program that reads a values for hour and minute from the input test file timeData.txt . The data read for valid hour and valid minute entries. Assume you are working with a 24 hour time format. Your program should use functions called validateHour and validateMinutes. Below is a sample of the format to use for your output file  timeValidation.txt :   ...

  • Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The progra...

    Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...

  • C++ (1) Write a program to prompt the user for an input and output file name....

    C++ (1) Write a program to prompt the user for an input and output file name. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs. For example, (user input shown in caps in first line, and in second case, trying to write to a folder which you may not have write authority in) Enter input filename: DOESNOTEXIST.T Error opening input file: DOESNOTEXIST.T...

  • FINDING THE LEAP YEARS (14 points) From Wikipedia, "A leap year (also known as an intercalary...

    FINDING THE LEAP YEARS (14 points) From Wikipedia, "A leap year (also known as an intercalary year or bissextile year) is a calendar year containing one additional day (or, in the case of lunisolar calendars, a month) added to keep the calendar year synchronized with the astronomical or seasonal year." In the Gregorian calendar, which is in use today, to determine leap year: A year is a leap year if it is divisible by 400 Or it is divisible by...

  • package _solution; /** This program demonstrates how numeric types and operators behave in Java Do Task...

    package _solution; /** This program demonstrates how numeric types and operators behave in Java Do Task #1 before adding Task#2 where indicated. */ public class NumericTypesOriginal { public static void main (String [] args) { //TASK #2 Create a Scanner object here //identifier declarations final int NUMBER = 2 ; // number of scores int score1 = 100; // first test score int score2 = 95; // second test score final int BOILING_IN_F = 212; // boiling temperature double fToC;...

  • ZYBOOKS LAB: 10.23.1 Hello, I'm trying to solve this problem with creating a program code in...

    ZYBOOKS LAB: 10.23.1 Hello, I'm trying to solve this problem with creating a program code in Python about People's Weights. Here is the question: 10.23 LAB: Warm up: People's weights (Lists) (1) Prompt the user to enter four numbers, each corresponding to a person's weight in pounds. Store all weights in a list. Output the list. (2 pts) Ex: Enter weight 1: 236.0 Enter weight 2: 89.5 Enter weight 3: 176.0 Enter weight 4: 166.3 Weights: [236.0, 89.5, 176.0, 166.3]...

  • I need this Program code made for Java please with the sample results. Echo Input from...

    I need this Program code made for Java please with the sample results. Echo Input from the Console to the Screen Using Methods Review the resources and instructions in the Discussion Prep Study before completing this discussion. For this discussion, you practiced using Java methods to echo input from the console to the screen. Create a Java program that reads in any value entered at the console and then prints it out to the screen. The program must have at...

  •    Lab/HW 3   Write a program that reads in the following data, all entered on one...

       Lab/HW 3   Write a program that reads in the following data, all entered on one line with at least one space separating them: a) an integer representing a month b) an integer representing the day of the month c) an integer representing a year 1. Check that the month is between 1 and 12. If it’s not print an error message. 2. Day cannot be 0 or less nor can it be more than 31 for all months. Print...

  • C Program In this assignment you'll write a program that encrypts the alphabetic letters in a...

    C Program In this assignment you'll write a program that encrypts the alphabetic letters in a file using the Vigenère cipher. Your program will take two command line parameters containing the names of the file storing the encryption key and the file to be encrypted. The program must generate output to the console (terminal) screen as specified below. Command Line Parameters Your program must compile and run from the command line. The program executable must be named “vigenere” (all lower...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT