subject

Three functions are required:get_input():This function takes no parameters, but will ask the user for an integer number. It will return a valid integer. You will use an indefinite loop and exception handling like we discussed in class. It is required to catch user input error and gracefully recover. Learn about the continue keyword and how it works in a loop; it can be handy. is_prime(n):This function will take an integer parameter n, and return True if the number is prime, or return False if it is not prime. You can use this pseudocode for primality testing to write this function. main():This does the bulk of your program’s work for solving Goldbach’s conjecture. You will call get_input() and is_prime(n) from main().Goldbach’s conjecture itself will be solved using an indefinite loop. Particularly a ‘post-test’ loop pattern. A for loop will not be accepted as part of the solution. OutputA successful run:This program tests the Goldbach's conjecturePlease enter an even integer larger than 2: 3636 = 5 + 31A run recovering from errors:This program tests the Goldbach's conjecturePlease enter an even integer larger than 2: 7Wrong input!Please enter an even integer larger than 2: fooBad input!Please enter an even integer larger than 2: 88 = 3 + 5If by chance the number chosen is valid, but doesn’t hold for Goldbach’s conjecture, then print:Goldbach's conjecture doesn't hold for [whatever the number is]

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 16:00
An english teacher would like to divide 8 boys and 10 girls into groups, each with the same combination of boys and girls and nobody left out. what is the greatest number of groups that can be formed?
Answers: 2
question
Computers and Technology, 24.06.2019 13:00
Your mom wants to purchase a laptop computer. she said she wants her new computer to be able to play her dvds so she can listen to music and wants to know what type of optical drives will play her disk. which type of drive should she look for?
Answers: 1
question
Computers and Technology, 24.06.2019 14:30
When workers demonstrate patience, are able to manage there emotions, and get along with other employees, which skills are being displayed?
Answers: 1
question
Computers and Technology, 24.06.2019 18:20
Acommon algorithm for converting a decimal number to binary is to repeatedly divide the decimal number by 2 and save the remainder. this division is continued until the result is zero. then, each of the remainders that have been saved are used to construct the binary number.write a recursive java method that implements this algorithm.it will accept a value of int and return a string with the appropriate binary character representation of the decimal number.my code: public class lab16{public string converttobinary(int input){int a; if(input > 0){a = input % 2; return (converttobinary(input / 2) + "" +a); } return ""; } }
Answers: 1
You know the right answer?
Three functions are required:get_input():This function takes no parameters, but will ask the user fo...
Questions
question
Biology, 19.01.2021 21:30
question
Mathematics, 19.01.2021 21:30
question
Chemistry, 19.01.2021 21:30
Questions on the website: 13722360