Concept explainers
Write a
Enter two floating-point numbers: 2.0 1.99998
They are the same up to two decimal places.
Enter two floating-point numbers: 2.0 1.98999
They are different.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Big Java Late Objects
Additional Engineering Textbook Solutions
Software Engineering (10th Edition)
Data Mining for Business Analytics: Concepts, Techniques, and Applications with XLMiner
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Starting Out with C++ from Control Structures to Objects (8th Edition)
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
- Write a program that will determine how many of a set of 10 numbers are even and how many are odd. a. Read in one number at a time. b. Compute and display the number of even integers and the number of odd integers. Hint: You can use the modulus operator (%) to determine if each integer is even or od. Your output should look like this: Enter integer: 2 Enter integer: 4 Enter integer: 3 Enter integer: 5 Enter integer: 6 Enter integer: 4 Enter integer: 77 Enter integer: 5 Enter integer: 89 Enter integer: 45 There are even numbers in the list 6 odd numbers in the list 4 There are >>>arrow_forwardWrite a program that reads an unspecified number of integers, determineshow many positive and negative values have been read, and computes the total and average of the input values (not counting zeros). Your program ends with the input 0. Display the average as a floating-point number.arrow_forwardWrite a program which prompts the user to enter an integer and prints a half diamond star pattern. Note: you can assume that the number will always be > 1. For example: Input Result 5 9 Enter number of columns: 5 * ** *** **** ***** **** *** ** * Enter number of columns: 9 * ** *** **** ***** ****** ******* ******** ********* ******** ******* ****** ***** **** *** ** * Answer: (penalty regime: 0.0 5 10 15 20 25 30 35 40 45 50 %)arrow_forward
- Write a program that takes ten integers from the input and displays them inversely in the output.arrow_forwardWrite a program that reads an integer and displays all its smallest factors, also known as prime factors. For example, if the input integer is 120, the output should be as follows: 2, 2, 2, 3, 5arrow_forwardWrite a program that uses a random number generator to generatea two digits positive integer and allows the user to perform one or moreof the following operations:a. Double the number.b. Reverse the digits of the number.c. Raise the number to the power of 2, 3, or 4.d. Sum the digits of the number.e. If the number is a two digits number, then raise the first digitto the power of the second digit.f. If the number is a three digits number and the last digit is lessthan or equal to 4, then raise the first two digits to the power ofthe last digitarrow_forward
- Write a program that prompts the user to enter a three-digit integer and determines whether it is a palindrome number. A number is palin-drome if it reads the same from right to left and from left to right.arrow_forwardWrite a program that reads a four-digit integer, such as 2014, and then displays it, one digit per line in reverse order, like so: 4 1 0 2 Your prompt should tell the user to enter a four-digit integer. You can then assume that the user follows directions. (Hint: Use the division andm remainder operators.)arrow_forwardWrite a program that reads 6 integers and displays the largest and the smallest amongst those integers.arrow_forward
- Write a program that accepts a set of integer numbers. Your program should count the number of even numbers and find the maximum even. Use -1 to stop your data entry. Sample Input/ Output: Enter integer numbers, Use -1 to stop your data entry. 12 33 66 -1 There are 2 even numbers. The maximum even number is 66.arrow_forwardWrite a program that calculates the sum of all positive integers less than or equal to a given number N.arrow_forwardWrite a program that calculates the equivalent resistance of a circuit. n electrical resistors with resistance values R1, R2,.., Rn are said to be connected in parallel if the same voltage is applied across each. Their equivalent resistance Reg is related to the values R1, R2, ..., Rn by: 1 1 1 1 + +...+ R R R, R. "eq Write a program that prompts the user to enter the resistance of n resistors. The user should be prompted continuously by using a while loop until a zero or negative value is entered (the program should count the number of resistors n entered by the user and store the values in an array). Use another separate loop to print the resistance values entered by the user and the equivalent resistance Reg. Test your program with R1= 1 kn, R2= 2 kn, R3= 4 kQ and R4= 8 kQ.arrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education