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
Concept explainers
Question
Write Java code that will start a series of commands 50 times. Each time through this code it should print two lines on the screen 50 times. Every other trip through the loop the starting with the first line should print “Hey now” Otherwise it should print “Check it.” In all cases, the second line printed should be “Watch it brother”
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps
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
- In Java Create a class DoWhileEvent3, write code that ask the user to enter a positive or negative number or 'x' 'X' to quit the program. When out of the loop the sum of all numbers entered is printed. READ THE USER'S input as String an not as integer. Use a do while loop.arrow_forwardNeed the answer in javaarrow_forwardCreate a have program that has the output given in the attached photoarrow_forward
- Javaarrow_forwardCreate a fully documented java applet that produces a Bulls Eye with six concentriccircles using two colors as shown below. You may choose your own color combination.(See pg. 260, Programming Project 13, Savitch).Use Named Constants to establish and maintain the x and y settings for the top leftcorner and the amount to change the diameter for each circle.Use a for loop to control the drawing of each of the 6 circles. Within the loop, determinethe correct graphic settings for the fillOval method by increasing the x, y values to moveinward; reducing the diameter for the new circle and alternating the color setting.hint: to determine color setting LoopCtr % 2 will alternate between 0 and 1Test your code using the AppletViewerarrow_forwardin java Integer valueIn is read from input. Write a while loop that iterates until valueIn is negative. In each iteration: Update integer result as follows: If valueIn is divisible by 5, output "win" and increment result. Otherwise, output "lose" and do not update result. Then, read an integer from input into variable valueIn. End each output with a newline. Click here for exampleEx: If the input is 5 15 11 -5, then the output is: win win lose Result is 2 Note: x % 5 == 0 returns true if x is divisible by 5. import java.util.Scanner; public class ResultCalculator { public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int valueIn; int result; result = 0; valueIn = scnr.nextInt(); /your code here/ System.out.println("Result is " + result); }}arrow_forward
- Write 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_forwardPasswords that are created by users are usually very simple and easy to guess. Create a Python program that takes a simpler pswrd + makes it stronger by taking characters using the rules below, and by appending "!" to the ending of the input string. i becomes 1 a becomes @ m becomes M B becomes 8 s becomes $ Example: If the input is: mypassword the output is: Myp@$$word! Hint: Python strings are immutable, but support string concatenation. Store and build the stronger password in the given password variable This is what I have so far.... word = input()password = ''arrow_forwardin java Jump to level 1 The first and second integers in the input are read into variables previousNum and currentNum, respectively. Write a loop that iterates until currentNum is not equal to 6 plus previousNum. In each iteration: Output currentNum, followed by " is 6 plus ", previousNum, and ". Sequence is increasing arithmetically." End with a newline. Assign previousNum with currentNum. Read the next integer from input and assign currentNum with the integer read. After the loop, output the last integer read followed by " breaks the sequence." and a newline. Click here for example Note: Assume that input has at least two integers. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import java.util.Scanner; public class Sequencing { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); intcurrentNum; intpreviousNum; previousNum=scnr.nextInt(); currentNum=scnr.nextInt(); System.out.println("Sequence starts at "+previousNum+"."); /* Your code…arrow_forward
- Create a program that creates a loop that prints out the numbers 1 to 100, butreplaces multiples of 3 with the word “Java”, multiples of 5 with the word“Programming”, and multiples of both with the word “JavaProgramming”. IN JAVAarrow_forwardin java Integer numInts is read from input representing the number of integers to be read next. Use a loop to read the remaining integers from input into variable value. For each integer from 0 to numInts minus 1, inclusive, output the integer followed by " grapes". End each output with a newline. Click here for exampleEx: If the input is: 2 14 12 then the output is: 14 grapes 12 grapes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import java.util.Scanner; public class NumberOfGrapes { publicstaticvoidmain(String[] args) { Scannerscnr=newScanner(System.in); intnumInts; intvalue; inti; numInts=scnr.nextInt(); /* Your code goes here */ } }arrow_forwardWrite a java program that will create a Deck object and shuffle the deck. Then, you will draw ten cards from the deck and perform selection statements that carry out the following: If the card is red, then print “Card is red” to the screen. Otherwise, print “Card is black” to the screen. If the card is a picture card, print “That's a picture card”. If the card is an ace, print “That's an Ace”. If the card has a value less than 6, print “Card has a small value”. If the card has a value between 6 and 10 (inclusive), print “Card has a large value”. In the source code, write an algorithm for the program in a comment block. Also, in a comment block, paste the results of running your program. Print out and turn in the completed source code with those comments.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
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