EBK JAVA PROGRAMMING
9th Edition
ISBN: 9781337671385
Author: FARRELL
Publisher: CENGAGE LEARNING - CONSIGNMENT
expand_more
expand_more
format_list_bulleted
Question
Chapter 2, Problem 15PE
Program Plan Intro
Minutes Conversion
Program Plan:
Import the required java package.
Define the class “MinutesConversion”.
- Define the main method.
- Declare the required variables to minutes, hours and days.
- Declare a named constant variable to hold the number of minutes in an hour and number of hours in a day.
- Create a scanner class object to get user input.
- Prompt the user to enter number of minutes.
- Store the user input in a variable.
- Compute number of hours in the minutes entered by user by dividing number of minutes entered and number of minutes in an hour.
- Compute number of days in the minutes entered by user by dividing number of hours and number of hours in a day.
- Display number of hours and days in the minutes entered by the user.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Write an application in java that prints the sum of cubes. Promptfor and read two integer values and print the sum of eachvalue raised to the third power.
Write in Java and use JOptionPane.showInputDialog
Write a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows.
When the program begins, a random number is ranged of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper, If the number is 3, then the computer has chosen scissors. (Don’t display the computer’s choice yet.)
The user enters his or her choice of “rock”, “paper”, or “scissors” at the key-board. (You can use a menu if you prefer.)
The computer’s choice is displayed.
A winner is selected according to the following rules:
If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors.)
If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cuts paper.)
If one player chooses paper and the other player chooses rock, then paper wins.…
In Java please
Chapter 2 Solutions
EBK JAVA PROGRAMMING
Ch. 2 - Prob. 1RQCh. 2 - Prob. 2RQCh. 2 - Prob. 3RQCh. 2 - Prob. 4RQCh. 2 - Prob. 5RQCh. 2 - Prob. 6RQCh. 2 - Prob. 7RQCh. 2 - Prob. 8RQCh. 2 - Prob. 9RQCh. 2 - Prob. 10RQ
Ch. 2 - Prob. 11RQCh. 2 - Prob. 12RQCh. 2 - Prob. 13RQCh. 2 - Prob. 14RQCh. 2 - Prob. 15RQCh. 2 - Prob. 16RQCh. 2 - Prob. 17RQCh. 2 - Prob. 18RQCh. 2 - Prob. 19RQCh. 2 - Prob. 20RQCh. 2 - Prob. 1PECh. 2 - Prob. 2PECh. 2 - Prob. 4PECh. 2 - Prob. 5PECh. 2 - Prob. 6PECh. 2 - Prob. 7PECh. 2 - Prob. 8PECh. 2 - Prob. 9PECh. 2 - Prob. 10PECh. 2 - Prob. 11PECh. 2 - Prob. 12PECh. 2 - Prob. 13PECh. 2 - Prob. 14PECh. 2 - Prob. 15PECh. 2 - Prob. 16PECh. 2 - Prob. 1GZCh. 2 - Prob. 3GZCh. 2 - Prob. 1CPCh. 2 - Prob. 2CP
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
- Java. Write an application that accepts a word from a user and converts it to Pig Latin. If a word starts with a consonant, the Pig Latin version removes all consonants from the beginning of the word and places them at the end, followed by ay. For example, cricket becomes icketcray. If a word starts with a vowel, the Pig Latin version is the original word with ay added to the end. For example, apple becomes appleay. If y is the first letter in a word, it is treated as a consonant; otherwise, it is treated as a vowel. For example, young becomes oungyay, but system becomes ystemsay. For this program, assume that the user will enter only a single word consisting of all lowercase letters.arrow_forwardPlease solve this question in java languagearrow_forwardWrite a java program that simulates a game of dice. In this game, 3 players will take alternateturns rolling two dice. On each turn, they record the sum of the two dice and add this totheir total. If a player rolls a doublet (both dice have the same value), then the player getsto roll again until the doublet disappears. After each turn (when both roll), the code checks the sum of each player and the firstplayer to reach a total of 15 or more will win the first place. When a player surpasses 15but with a doublet (both dice have the same value), the player still gets to roll again untilthe doublet disappears. The code then checks for the second and third place winners. Thecode will print out to the user the winners in order. If 2 or all the players hit the same sum, you can consider them all first place winners (forexample, if player 1 and 2 hit the same sum that’s >= 15 and 3rd player hits a sum lessthan 15, then you can say 1st and 2nd players win first place and 3rd wins second…arrow_forward
- HangmanAA.java For this program, you will create the game Hangman. (If you are unsure of how to play Hangman, Google it.) The game will start by asking player 1 for a word or phrase (can be multiple words). Then player 1 will be asked how many missed guesses are allowed by player 2. Once this information is received, player 2 will take over. (Have the program print many blank lines of space so that player 2 can’t see what player 1 entered.) The instructions should be displayed for player 2 as well as the number of misses they’re allowed to make before they lose the game. The screen should also output dashes or underscores to represent each letter of player 1’s secret word/phrase. Player 2 should guess one letter at a time. Case should not matter. Typing x or X should give the same result. If that letter is present in the mystery phrase, then it should be displayed. (It will replace the dash/underscore in that spot. Spaces, punctuation, and all other non-alphabetic characters should…arrow_forwardin Java Read the input line one at a time. If you read less than 200 lines output nothing. If you read less than 500 lines then output the 200th line in sorted order of the input lines. If you read more than 1000 or more lines, then only consider the last 1000 lines, and output the 200th line in sorted order from the last 1000 lines. Do not store more than 1001 lines.arrow_forwardIn java write a complete Java program that displays all the numbers, from 1 to 200, that are divisible by both 2 and 3. Numbers are separated by exactly one space.arrow_forward
- in Java Write a program that establishes two savings accounts with saver1 having account number10002 with an initial balance of $2,000, and saver2 having account 10003 with an initialbalance of $3,000. Set a common rate of interest at 5% per year. At the end of each month,update the balance by adding one month’s interest to the balance, so that the balancecompounds monthly. Print an output that displays the month number and the account numberand the balance for each of the two accounts. Use month 0 to display the initial balances, month1 to display the balances after the first month’s interest, and so on. At the end of the year,display the total balance for both accounts combined, like this:Output:Monthly balances for one year with 0.05 annual interest:Month Account # Balance Account # Balance----- --------- ------- --------- ------- 0 10002 2000.00 10003 3000.00 1 10002 2008.33 10003 3012.50 2 10002 2016.70 10003 3025.05 3 10002 2025.10 10003 3037.66 4 10002 2033.54 10003 3050.31 5…arrow_forwardwrite a java program A twin prime is a prime number that is either 2 less or 2 more than another prime number. For example (41, 43) are both primes and are twin primes because 41 + 2 = 43. Write a program that asks the user to enter a positive number and checks if this number is prime. If the number is prime then the program must check if it has a twin prime. So if n is prime, then n - 2 or n + 2 should be checked. The program repeats until the user enters -1. Sample Run: Enter a positive integer (-1 to end): -5 Invalid Number Enter a positive integer (-1 to end): 61 61 is prime 59 and 61 are twin prime Enter a positive integer (-1 to end): 137 137 is prime 137 and 139 are twin prime Enter a positive integer (-1 to end): 30 30 is not prime Enter a positive integer (-1 to end): 23 23 is prime 23 does not have a twin prime Enter a positive integer (-1 to end): -1arrow_forwardWrite a Java program (TicTacToe.java) for playing tic-tac-toe. You may assume that two human players are playing against each other. Your program should display an updated board before every turn, prompt the user to enter the row and column in which to play, and display "X wins!", "O wins!", or "Tie!" at the end of the game. Here is a sample run of a correct program (user input indicated by orange text):Let's play Tic-Tac-Toe! - - -- - -- - -Enter a row and column (1, 2, 3) for player X: 2 2 - - -- X -- - -Enter a row and column (1, 2, 3) for player O: 2 3 - - -- X O- - -Enter a row and column (1, 2, 3) for player X: 1 1 X - -- X O- - -Enter a row and column (1, 2, 3) for player O: 1 3 X - O- X O- - -Enter a row and column (1, 2, 3) for player X: 3 3 X - O- X O- - XX wins!arrow_forward
- Write a code that generates a random lowercase letter. In java programming. Note: Not a string of letters just one letter is generated every time the program is run. meaning the output should not be something like this: a c t c -that's a random string, it should only be one random letter generated randomly.arrow_forwardWrite a program that prompts the user to enter adecimal number and displays the number in a fraction. (Hint: read the decimalnumber as a string, extract the integer part and fractional part from the string,and use the BigInteger implementation of the Rational class in Programming to obtain a rational number for the decimal number.) Here are somesample runs: Enter a decimal number: 3.25 ↵EnterThe fraction number is 13/4 Enter a decimal number: –0.45452 ↵EnterThe fraction number is –11363/25000arrow_forwardA program in javaarrow_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
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License