Test plan 3
.docx
keyboard_arrow_up
School
University of Maryland, University College *
*We aren’t endorsed by this school
Course
115
Subject
Computer Science
Date
Feb 20, 2024
Type
docx
Pages
4
Uploaded by DirtyMoe
Test plan 3
Kaleb Miranda
CMSC 115
Chapter 4 Programming project 1
Pseudocode:
1.
Start
2.
Display “This program calculates the area of a regular polygon.”
3.
Prompt the user to enter the number of sides (n).
4.
Read n from the user.
5.
Prompt the user to enter the length of a side (s).
6.
Read s from the user.
7.
Calculate pi as 3.141592265359
8.
Calculate angle = 360 degrees / n
9.
Calculate area = (n * s^2) / (4 * tan(pi / n))
10. Display “The area of the polygon is “ + area “
11. End
Flowchart:
Start: Display program purpose
Prompt user to enter number of sides
Read n from user
Prompt user to enter the legth of a side (s)
Read s from user
Calculate pi as 3.14159265359
Calculate angle = 360 degrees / n
Calculate area = (n * s^2) / (4 * tan(pi / n))
Display "the area of the polygon is" + area.
END
Test Plan: Test Case 1:
Input: n = 5, s = 6.5
Expected Output: The area of the polygon is 72.69017017488385
Test Case 2:
Input: n = 6, s = 8.0
Expected Output: The area of the polygon is 138.21243150588603
Test Case 3:
Input: n = 8, s = 10.0
Expected Output: The area of the polygon is 309.0169943749474
Test Case 4:
Input: n = 12, s = 15.0
Expected Output: The area of the polygon is 907.2290640106801
Test Case 5:
Input: n = 3, s = 7.0
Expected Output: The area of the polygon is 31.745959053647685
Chapter 4 Programming project 5
Pseudocode:
1. Start
2. Display "Enter a SSN (in the format DDD-DD-DDDD): "
3. Read SSN from the user and store it in a string variable ssn
4. Set isValid to true
5. If the length of ssn is not equal to 11, then
6. Set isValid to false
7. For i from 0 to length of ssn - 1, do the following:
8. Get the character at position i and store it in a variable c
9. If i is equal to 3 or i is equal to 6, then
10. If c is not equal to '-', then
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Basic Computer Programming ActivityLanguage: CShow the code and how it works thanks
arrow_forward
Looping for Statements
Write a program that will display a multiplication table with the format
shown below. The range of the table
2
10
10
20
30
100
X123
1123
X
3
10
2246
3369
2
4
10 20 30
arrow_forward
The Lottery Problem:
• The lottery draws a number that is the winning number
• The number should be between 0 and 999
• Have someone play
• The person tells how many tickets they want
• The person always does “quick pick” (let the computer pick the number for them) and gets one number between 0 and 999 for each ticket bought
• The program reports how many tickets win of the ones bought
• NOTE: A ticket “wins” if it matches the winning number previously chosen
• Write working code with at least one function and one sub other than “main”
arrow_forward
Canvas Login - Santa Monica College
E Quiz: Module 3: Assignment - Loops
G The lecture demonstrated how to read a line wit
Problem Statement
Output Numbers from 1 to N: Write a program that prints out every other number between 1 and N where N is entered by the user. The numbers must be separated by a comma and a space. The last number must not have a comma
following it. The program is repeated until a number smaller than 1 is entered at which point the program outputs "Goodbye!"
Example:
Enter N: 7
1, 3, 5, 7
Enter N: 10
1, 3, 5, 7,9
Enter N: -1
Goodbye!
Partial Solution
Please try to implement the full source code in your IDE first. The solution is partially provided below. Fill in the blanks to complete the missing parts and make sure to not add an empty space before and after the answer.
using namespace std;
int
Int n- 0;
/get a user input for n
cout>
lprintout every other number
(int i- 1;1 <- n; i +- 2){
cout <<
Nprintout a comma after a number but not the last one.
Iffl < n-1){…
arrow_forward
HELP NEEDED ASAP!
Language: JAVA
Write a program in Java that takes an integer value as input from the keyboard and prints a pattern like a right-angle triangle with the line number. For input value 4 the pattern is as follows:
1
22
333
4444
Hint: use nested loops.
arrow_forward
Calculator Challange
Python Coding
Create a simple calculator that takes in TWO numbers from the user and then asks the user to select if they want to ADD, SUBTRACT, MULTIPLY or DIVIDE to get the answer.
I have coded...
print("input whole numbers please, no decimals")again=""while again!="N":first=int(input("What is the first number?"))last=int(input("What is the last number?"))#let user pick the operation, assign numbers to the operationsoperation=int(input("Would you like to 1) add, 2)subtract, 3)multiply, or 4) divide?"))if operation==1:answer=first+lastelif operation==2:answer=first-lastelif operation ==3:answer=first*lastelif operation == 4:answer=first/lastelse:print("You did something wrong, try again.")print("The answer: %s"%(answer))again=str(input("Would you like to go again? Y/N")).upper()same=str(input("Would you like to use the same two numbers? Y/N")).upper()while same=="Y":operation = int(input("Would you like to 1) add, 2)subtract, 3)multiply, or 4) divide?"))if…
arrow_forward
python programming language
arrow_forward
Instruction: Create a notation resembling a simplified programming language with the input and output of a counting problem.
Write a program with the specified input and output:
Create a program for geometric sequence (initial value and common ratio)
arrow_forward
Python Programming Question
arrow_forward
flow chart and dimple program. Python thank you
arrow_forward
C# programming language:
1.1 Prompt the user to enter a positive integer n and then write a program to program to display the first n natural numbers and their sum.
arrow_forward
Task 2: Multiples
Write a program that asks the user for an integer n, and then prints first 10 multiples of that integer. Use a
while/do...while loop.
Example:
Enter an integer: 2
Output:
2 x 1 = 2
2 x 2 = 4
2 х 3 %3D 6
2 x 4 = 8
2 x 5
= 10
12
2 х6
2 x 7
2 х8
14
16
2 x 9
18
2 x 10 =
20
arrow_forward
PYTHON QUESTION
arrow_forward
HELP NEEDED ASAP!
Language: JAVA
Write a program that prompts the user for a value greater than 10 as an input (you should loop until the user enters a valid value) and finds the square root of that number and the square root of the result, and continues to find the square root of the result until you reach a number that is smaller than 1.01. The program should output how many times the square root operation was performed.
arrow_forward
Fix the code
arrow_forward
Find the C program language
Starting My Business
by CodeChum Admin
I want to be an entrepreneur! But I don't have capital, could you help me find one? Hihi
Instructions:
Ask the user for an array of characters/string. For this program, it is guaranteed that the input of the user has one and only one capital character.
Your task is to search for that one capital character and then print it and its index.
Input
1. Inputted string
Output
Enter·a·string:·jejuMar
Capital·M·found·at·index·4
arrow_forward
The property of addition states that two numbers can be added in either order to get the same result.
arrow_forward
help me doing these programms.
CSE PYTHON programs:
1. Program to Check Whether a Given Year is a Leap Year
2. Program to Read Height in Centimeters and then Convert the Height to Feet and Inches
3. Program to Take the Temperature in Celcius and Covert it to Farenheit
4. Program to Compute Prime Factors of an Integer
5. Program to Generate all the Divisors of an Integer
6. Program to Print Table of a Given Number
7. Program to Print Sum of Negative Numbers, Positive Even Numbers and Positive Odd numbers in a List
8. Program to Print Largest Even and Largest Odd Number in a List
9. Program to Find Those Numbers which are Divisible by 9 and Multiple of 3 in a Given Range of Numbers
10. Program to Check if a Number is an Armstrong Number
11. Program to Print the Pascal's triangle for n number of rows given by the user
12. Program to Check if a Number is a Perfect Number
13. Program to Check if a Number is a Strong Number
14. Program to Find the LCM of Two Numbers
15. Program to…
arrow_forward
Compare Numbers - Python Language please!
Programming challenge description:
Little Tommy is in kindergarten on the first day of class. His teacher has taught him about inequalities today, and he is learning how to draw crocodiles to represent them. When there are two numbers, A and B, there are three options:1. If A is greater than B, then draw '>'. The crocodile's mouth is pointed toward the bigger number, A.2. If A is less than B, then draw '<'. The crocodile faces B.3. If A is equal to B, draw '='. The crocodile is confused and keeps its mouth shut.Unfortunately, Tommy does not like to do his homework, and has bribed you to write a program to do it for him.
Input:
The input consists of two integers A and B on a line, separated by a space. |A,B| < 2^63.
Output:
Print a line containing the appropriate symbol that describes the relationship between the numbers.
Test 1
Test InputDownload Test 1 Input
35 40
Expected OutputDownload Test 1 Output
<
arrow_forward
Computer science
arrow_forward
Python Progamming
Topic: Conditionals
Qyestion:
Write a program that simulates the throwing of a 9-sided die and a 9000-sided die, indicating whether or not the sum of the results is a multiple of three.
arrow_forward
4) Roll the dice 2
Make a program that tests the probability of a certain score when rolling x dice. The user should be
able to choose to roll eg 4 dice and test the probability of a selected score eg 11. The program should
then do a number of simulations and answer how big the probability is for the selected score with as
many dice selected. There must be error checks so that you cannot enter incorrect sums, for
example, it is not possible to get the sum 3 if you roll 4 dice.
TarningsKast2
How many dices do you want to throw?
11
Which number do you want the probability for?
The probability the get the number 11 with 4 dices is 7.19%
Calculate
arrow_forward
1.
Write a program that lets the user
guess whether a randomly generated integer
would be even or odd.
The program randomly generates an
integer and divides it by 2. The integer is even
if the remainder is 0, otherwise odd. The
program prompts the user to enter a guess and
reports whether the guess is correct or
incorrect.
arrow_forward
On Thursday, November 4, 2021, Big Man Games wrote:
Computer programs are great at computing mathematical formulas. Once the formula is properly encoded you can use the code as much as you want without reprogramming it and you can share it with non-programmers without any trouble. This lab is an example of such a formula. Once you program it you won’t have to worry about the area of a circle again.
Write and test a program that computes the area of a circle. This program should request a number representing a radius as input from the user.
Use the formula 3.14 × radius2 to compute the area.
Tip: There are a couple of ways to code an exponent. Look in the Operators unit for help (and you can’t use an x for multiplication).
Tip: You will need to use the float data type to compute the remainder.
The output should explain the results. Don’t just print a number.
Tip: For your print statement you will need to use the comma, “,”, or plus, “+” symbols to stitch your output together.
(“The…
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Related Questions
- Basic Computer Programming ActivityLanguage: CShow the code and how it works thanksarrow_forwardLooping for Statements Write a program that will display a multiplication table with the format shown below. The range of the table 2 10 10 20 30 100 X123 1123 X 3 10 2246 3369 2 4 10 20 30arrow_forwardThe Lottery Problem: • The lottery draws a number that is the winning number • The number should be between 0 and 999 • Have someone play • The person tells how many tickets they want • The person always does “quick pick” (let the computer pick the number for them) and gets one number between 0 and 999 for each ticket bought • The program reports how many tickets win of the ones bought • NOTE: A ticket “wins” if it matches the winning number previously chosen • Write working code with at least one function and one sub other than “main”arrow_forward
- Canvas Login - Santa Monica College E Quiz: Module 3: Assignment - Loops G The lecture demonstrated how to read a line wit Problem Statement Output Numbers from 1 to N: Write a program that prints out every other number between 1 and N where N is entered by the user. The numbers must be separated by a comma and a space. The last number must not have a comma following it. The program is repeated until a number smaller than 1 is entered at which point the program outputs "Goodbye!" Example: Enter N: 7 1, 3, 5, 7 Enter N: 10 1, 3, 5, 7,9 Enter N: -1 Goodbye! Partial Solution Please try to implement the full source code in your IDE first. The solution is partially provided below. Fill in the blanks to complete the missing parts and make sure to not add an empty space before and after the answer. using namespace std; int Int n- 0; /get a user input for n cout> lprintout every other number (int i- 1;1 <- n; i +- 2){ cout << Nprintout a comma after a number but not the last one. Iffl < n-1){…arrow_forwardHELP NEEDED ASAP! Language: JAVA Write a program in Java that takes an integer value as input from the keyboard and prints a pattern like a right-angle triangle with the line number. For input value 4 the pattern is as follows: 1 22 333 4444 Hint: use nested loops.arrow_forwardCalculator Challange Python Coding Create a simple calculator that takes in TWO numbers from the user and then asks the user to select if they want to ADD, SUBTRACT, MULTIPLY or DIVIDE to get the answer. I have coded... print("input whole numbers please, no decimals")again=""while again!="N":first=int(input("What is the first number?"))last=int(input("What is the last number?"))#let user pick the operation, assign numbers to the operationsoperation=int(input("Would you like to 1) add, 2)subtract, 3)multiply, or 4) divide?"))if operation==1:answer=first+lastelif operation==2:answer=first-lastelif operation ==3:answer=first*lastelif operation == 4:answer=first/lastelse:print("You did something wrong, try again.")print("The answer: %s"%(answer))again=str(input("Would you like to go again? Y/N")).upper()same=str(input("Would you like to use the same two numbers? Y/N")).upper()while same=="Y":operation = int(input("Would you like to 1) add, 2)subtract, 3)multiply, or 4) divide?"))if…arrow_forward
- python programming languagearrow_forwardInstruction: Create a notation resembling a simplified programming language with the input and output of a counting problem. Write a program with the specified input and output: Create a program for geometric sequence (initial value and common ratio)arrow_forwardPython Programming Questionarrow_forward
- flow chart and dimple program. Python thank youarrow_forwardC# programming language: 1.1 Prompt the user to enter a positive integer n and then write a program to program to display the first n natural numbers and their sum.arrow_forwardTask 2: Multiples Write a program that asks the user for an integer n, and then prints first 10 multiples of that integer. Use a while/do...while loop. Example: Enter an integer: 2 Output: 2 x 1 = 2 2 x 2 = 4 2 х 3 %3D 6 2 x 4 = 8 2 x 5 = 10 12 2 х6 2 x 7 2 х8 14 16 2 x 9 18 2 x 10 = 20arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr