Concept explainers
Computers are playing an increasing role in education. Write a program that will help an elementary-school student learn multiplication. Use Math.random to produce two positive one-digit integers. It should then display a question such as
How much is 6 times 7?The student then types the answer into a text field. Your program checks the student’s answer. If it’s correct, display the string "Very good!" and generate a new question. If the answer is wrong, dis- play the string "No. Please try again." and let the student try the same question again repeatedly until he or she finally gets it right. A separate function should be used to generate each new ques- tion. This function should be called once when the script begins execution and each time the user answers the question correctly.
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 4 images
- String personName is read from input. Output personName left aligned with a width of 6, followed by " Taylor". End with a newline. Ex: If the input is Juno, then the output is: Juno Taylor Use Javaarrow_forwardCreate a card game in which the dealer shuffles the deck and deals 13 cards to the player. The player sorts her hand and says whether it includes the King of Hearts. Repeat 4 times so all the cards are dealt eventually. Internally, the player should return true or false without writing to the console. In response, the dealer should write on the console, "You won!" or "You loose again."arrow_forwardJAVA PROGRAMarrow_forward
- In this assignment you will demonstrate your knowledge of debugging by fixing the errors you find in the program below. Fix the code, and paste it in this document, along with the list of the problems you fixed.This example allows the user to display the string for the day of the week. For example, if the user passed the integer 1, the method will return the string Sunday. If the user passed the integer 2, the method will return Monday. This code has both syntax errors and logic errors. Hint: There are two logic errors to find and fix (in addition to the syntax errors).Inport daysAndDates.DaysOfWeek;public class TestDaysOfWeek {public static void main(String[] args) {System.out.println("Days Of week: ");for (int i = 0;i < 8;i++) {System.out.println("Number: " + i + "\tDay Of Week: " + DaysOfWeek.DayOfWeekStr(i) )}}}package daysAndDatespublic class DaysOfWeek {public static String DayOfWeekStr(int NumberOfDay) {String dayStr = ""switch (NumberOfDay) {case 1:dayStr =…arrow_forwardusing java (Use the Date class) Write a program that creates a Date object, sets its elapsedtime to 10000, 100000, 1000000, 10000000, 100000000, 1000000000,10000000000, and 100000000000, and displays the date and time using thetoString() method, respectively.arrow_forwardIn java: ( no stringbuild or chart.append) the program must produce a neatly labeled bar chart depicting the relative values to each other. Note that there is no interactive input and no use of command line arguments. The program at this stage uses values programmed directly into it. The program output must include the original values as well as the bars. The example below shows the relative number of performances of some Broadway musicals (in picture) You choose the width of the chart. In the example above, it's 60, but it can be different. The largest value in your set should use the entire width, the rest of the bars will be proportionately shorter. Since you're assigning the values in the program, you know the maximum and no special logic is required to find it You must compute and display the "scale" of the chart (i.e. how many units one bar symbol represents) Each bar is labeled with the entity and value You may choose any symbol for your bars 3. In…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