Write at least two test cases to check for errors

Assignment Help Programming Languages
Reference no: EM13698067

Program 1: Write a program that accepts a given number an input from the user and prints prime numbers up to that number.

Program 2: Write at least two test cases to check for errors, e.g., you can check whether the user entered a positive number as an input (up to which prime numbers are to be printed), so if the user enters a negative value, that is an error.  This is an example of checking a pre-condition, i.e., before the execution of a method.

You can also check if the numbers output by the program are indeed prime, e.g., if any of the numbers output is divisible by 2, then that is an error. This is an example of checking for a post-condition, i.e., after execution of a method. 

Program 3: Introduce intermediate print statements in your program for additional debugging. For      example, after the user enters a number, you can print that number and so forth

You need to make well-formed and clean code. You should not copy and paste the code from other source.

Reference no: EM13698067

Questions Cloud

Write an interactive prolog program : Write an interactive Prolog program in which a user enters a positive integer and then displays the power of 2 to that number. For example, if the user enters 4, the program calculates the power 2.
How can you minimize the quantization error : How can you minimize the quantization error - Just a simple and quick answer and please no copy and paste.
Nyquist sampling theorem : The Nyquist Sampling Theorem states that digital sampling of an analog signal must be at least twice the rate of the highest frequency of the analog signal in order to accurately reproduce the original signal at the receiver.
What is the lan utilization : Given a LAN of 1Gbps/sec, and making 15 requests/sec to a link for 1Mbits/request of object size, what is the LAN utilization?
Write at least two test cases to check for errors : Write a program that accepts a given number an input from the user and prints prime numbers up to that number.
How could you copy all the files from the current directory : How could you move all the files that end with an extension *.h in your home directory to the current directory without knowing the full path to the current directory [Hint: use a shortcut for the home directory and current directory.
Show each of these specifications using predicates : For every security breach there is at least one mechanism that can detect that breach if and only if there is a process that has not been compromised
Algorithm to compute binomial coefficients : Analyze the time taken by this algorithm under the unreasonable assumption that the addition C(n-1, k-1) + C(n - 1, k) can be carried out in constant time once both C(n-1, k-1) and C(n - 1, k) have been obtained recursively.
Write a program in java that reads a file : Write a program in Java that reads a file of numbers of type int and outputs all the numbers to another file, but without there being any duplicate numbers.

Reviews

Write a Review

Programming Languages Questions & Answers

  Create application to generate a series of random numbers

Create the application to generate a series of 100 random numbers in the range of 1 through 1000. Save the series of numbers in a file.

  Provide a brief history of the language

Provide a brief history of the language (1-2 slides) including standards if any. What need does this language fill that others do not and discuss the language in terms of the paradigms described in Chapters 1-5 of our textbook. Provide code sample..

  Write program in vb dot net for mortgage payment amount

Write down the program in VB.Net (not Web based) by using the loan amount of $200,000 with the interest rate of 5.75% and 30 year term.

  Create prototype of function which returns integer value

Develop the C++ function which needs one integer parameter and returns the integer value. Function will double the value passed to it and return doubled value.

  Write program to prompt for and accept current salary

Write a program that will prompt for and accept the current salary for each of the faculty members, then calculate and display their individual pay increases.

  Implement a program that processes an input file

Implement a program that processes an input file by changing every occurrence of an old string into a new string. (e.g., the usage is: chstr.pl file oldstring newstring, chstr.pl is your program name, file, oldstring and newstring are parameters ..

  Which of the following is not included in a pseudocode

Which of the following is not included in a pseudocode program?

  Program display error message if test score is invalid

The program must display suiatble letter grade. The program must display an error message if the test score is 100.

  Write program to prompt user to enter string of caharacter

Write a program that prompts the user to enter a string of 87 characters the program should display the middle character in the string if there is an odd number characters in the string.

  Design program to list total points scored for classroom

Student ID, classroom number, and score on the achievement test. Design a program that lists the total points scored for each of the 30 classrooms.

  Application to convert kilometers in miles

Application will input number of kilometers, compute number of miles, and display number of miles. You will use a constant to store the kilometers-to-miles conversion factor.

  Develop a simple program for inventory system

You have to develop a simple program for an inventory system. You can choose any type of business (ie: Medical supplies, bakery, grocery shop, florist etc.)

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd