Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
Write a Java program that will make a calculator that calculates any two numbers together,use a if statement also a while loop for this program. Use a for loop, a nested loop or if statement, and switch.Use at least 3 different primitive data types. Use at least one string and one string method. Create some sort of calculation with the numbers like multiplying,subtracting and add these two numbers. Create at least one method for any calculations or transformations that you do.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Generate a list of 10 random numbers with values between 1 and 20, and submit the first 10 numbers as an answer to this question. (Use any random number generator). For the purpose of using them in the next questions, call these numbers A, B, C, D, . . . J Convert Aπ/B into degrees. Find the result ofa. Degrees = (A × B × C) + 180 mod 180; this is the remainder after dividing (A × B × C) + 180 by 180 b. Convert Degrees into radians, and put the answer in π notation. Calculate the measurements of the acute angles of a right triangle whose sides measure A, B, C units. Build a matrix, M, of random numbers as follows: A B C D E F G H I What is MT? Find the inverse of M, showing the steps. What is the result of M * M−1? Let V = [A B C] and W = [ D E F]. In the textbook, the dot product V • W involves an angle, alpha (α). How do you calculate alpha for this example? Let V = [A B C]. Find the cross product V • V. What can you conclude from this…arrow_forwardComplete the task in java and please dont use AI write it on your own.write it in simple code pleasearrow_forwardWrite a java program which asks the user to enter name and age and calls the following methods: a. printName(): Takes name as parameter and prints it 20 times using a while loop. b. printAge(): Takes age as parameter and prints all the numbers from 1 up to age. Please strictly follow this format. Note: any extra or missing space / line will lead to test failure. Name: Andy Age: 10 Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy Andy 1,2,3,4,5,6,7,8,9,10 class Main {public static void main(String[] args) {}}arrow_forward
- Print numbers 0, 1, 2, ..., userNum as shown, with each number indented by that number of spaces. For each printed line, print the leading spaces, then the number, and then a newline. Hint: Use i and j as loop variables (initialize i and j explicitly). Note: Avoid any other spaces like spaces after the printed number. import java.util.Scanner;public class NestedLoop {public static void main (String [] args) {Scanner scnr = new Scanner(System.in);int userNum;int i;int j; userNum = scnr.nextInt();arrow_forward5. Write a Java program that uses a for iteration statement in order to generate and print the output shown below. Your program should use only a single System.out.println method for printing all the numbers. (2 points) 2 HOS DAN 4 6 8 10arrow_forwardIn Java Integer in is read from input. Write a while loop that iterates until in is less than or equal to 0. In each iteration: Update in with the quotient of in and 7. Output the updated in, followed by a newline. Click here for exampleEx: If the input is 2401, then the output is: 343 49 7 1 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 import java.util.Scanner; public class QuotientCalculator { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); intin; in=scnr.nextInt(); /your code here/ } }arrow_forward
- The language is Java. The chapter it is in is on Looping.arrow_forwardPlease solve this in Java Thankarrow_forwardStatistics are often calculated with varying amounts of input data. Write a program that takes any number of non-negative integers as input, and outputs the average and max. A negative integer ends the input and is not included in the statistics. Ex: When the input is: 15 20 0 5 -1 the output is: 10 20 You can assume that at least one non-negative integer is input. import java.util.Scanner; public class LabProgram {public static void main(String[] args) {Scanner scnr = new Scanner(System.in);int numValue;int average;int max;int numValues;int numTotal;numTotal = 0;numValues = 0;max = 0;numValue = scnr.nextInt();while (numValue > 0){numTotal = numTotal + numValue;numValues = numValues + 1;numValue = scnr.nextInt();}average = numTotal / numValues;System.out.print(average);while (numValues > max){max = numValues;System.out.print(" " + max);} }} Why is it giving me the wrong output??arrow_forward
- Write a program using while loop and for loops to print first 50 prime numbers in 5 lines, each line containing 10 numbers. 1. Create a program called CountCharacters.java. 2. At the top of your java file add the following documentation comments. Replace the italicized text with the appropriate content. /** @author Your Name CS 110 Section 012 Lab 9 Final Today's Date 3. Import the Scanner class and ask user to enter a line. Implement the while loop so that the user can input any number of lines and one line at a time. To stop entering lines, the user can write "quit. (Hint: Use the string method <str>.equals() in the while condition to stop the while loop OR a break keyword). 4. Implement the for loop inside the while loop to iterate through the line one character at a time to count and output the number of blank spaces, alphabetic characters, digit characters, and other characters in all the lines. You need to use different methods of character class like charAt(), isDigit(),…arrow_forwardPython Programming ONLY PLEASE NO JAVA Use recursion to determine the number of digits in an integer n. Hint: If n is < 10, it has one digit. Otherwise, it has one more digit than n / 10. Write the method and then write a test program to test the method Your test program must: Ask the user for a number Print the number of digits in that number. (describe the numbers printed to the console) Use program headers and method header comments in your code.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- 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
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education