Sale!

COP3223C Small Program 3 Solved 

Original price was: $35.00.Current price is: $30.00.

Download Details:

  • Name: smallprogram3-k1kuqm.zip
  • Type: zip
  • Size: 272.20 KB

Category:

Description

5/5 - (1 vote)

Problem 1

Write the definition of a user-defined function called letters. The function will determine if
a character value is a letter in the English Alphabet. The function has no parameters. Inside,
the definition, you will prompt the user to input a character.

If the letter is lowercase, then the
message “Lower!” is displayed to the terminal. If the letter is uppercase, then the message
“Upper!” is displayed to the terminal. If the character value is not part of the alphabet, then
the message “Not a Letter!” is displayed to the terminal. Hint, think about what happens
when characters are evaluated.

The following figure shows a sample output scenario when the
letter is lowercase. Make sure your output matches to receive potential credit. Do not worry if
the user enters multiple characters at once. We have not learned strings yet!
Figure 1: Sample output when the key entered from the keyboard is a lowercase letter from the
English Alphabet.

Problem 2

You are a super being in need of a super lawyer. You learned that Jennifer Walters is in your city
representing super humans who may unintentionally leave a mess behind from saving the day.
You dial the number 1-877-SHE-HULK.

You connect with the operator who sounds like Jennifer
Walters telling you all of the services that the Superhuman Law Division at GLK&H offers. Write
Figure 2: Table for problem 2 that shows the message for each option.
a user defined function called greenLawyer that displays the list of options, allows the user
Small Program 3 Page 5

Figure 3: Sample output for problem 2. This shows the welcoming message along with the
result of the option selected.
to select one, and then display the result.

If none of the values match, then the message “I’m
sorry. I don’t recognize that super being option.” is displayed to the terminal window. Inside the
user defined function you will display a welcoming message and list the options for the user.

Figure 3 shows a sample text to be displayed as the welcoming message along with selecting
the output and the result. Make sure it is exact to receive potential credit as the script will check
for it. You must also use a switch statement for this question to receive full points. If a
switch statement is not used then the highest mark you can receive is half mark on the
rubric evaluation.

Problem 3

Write a user defined function definition called coordinates that takes x-y coordinates of a
point in the Cartesian plane and prints a message telling either an axis on which the point lies
or the quadrant in which it is found.
Figure 4: Quadrants in the 2D coordinate plane.

The user defined function takes two double arguments and doesn’t return anything. Hint:
Don’t forget x-axis, y-axis and origin. The coordinates are collected in the main function. The
following figure shows a sample output.

Make sure the output matches for the script to receive
credit. The values of the coordinates must be displayed up to two decimal places.
Small Program 3 Page 6
Figure 5: Sample output for problem 3. Make sure your output is in this format for the script!

Problem 4

You are working for a architecture company that loves designing triangle shape buildings. The
company has grown that they are able to create their own software to perform some blue print
designs rather than having someone design manually by hand. Part of the software is configuring measurements to ensure that the potential building is in the shape of a valid triangle.

Figure 7 shows the geometric definition of what determines a shape to be a valid triangle. Using
Figure 6: The triangle and its properties of validation.
these properties, write the definition of a user-defined function called triangle. The function
has three parameters that are all integer type.

Each parameter represents the length of the
side. Assume that the input is always collected in abc order. Inside the main function, you will
ask the user for the length of each of the sides. Once the input is collected, you will call the
user-defined function and perform the respective operation that was asked in this problem.

The
function will display the logistics it is checking to determine if the values represent a triangle
or not. The function also returns an integer value which represents the outcome. The value
1 returned means the shape is a valid triangle. The value -1 means otherwise.

Using those
values, you will then display the outcome message in the main function. If the value is 1, then
“Triangle!” is displayed. Otherwise display “Not Triangle!”. The following figure shows a sample
output of what the python script expects.

Make sure to have it exact in terms of white space,
newlines, and characters or else the script will mark it wrong.
Figure 7: Sample output of problem 4. Make sure your output is in this format for the script!
Small Program 3 Page 7