Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)
11th Edition
ISBN: 9780134743356
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
Question
Book Icon
Chapter 6, Problem 15.3E
Program Plan Intro

Separating Digits

Program Plan:

  • Import required packages.
  • Declare the class “Digits”.
  • Define the main method.
    • Create an object “in” for the scanner class.
    • Declare the required variable.
    • Get the integer from the user.
    • Check the “num” is not equal to “0”.
      • Check the condition using “if” statement.
        • Call the method “dispalyDigits()”.
      • Otherwise, print the statement.
      • Get the integer from the user.
    • Definition of method “quotient()”.
      • Return the value.
    • Definition of method “remainder()”.
      • Return the value.
    • Definition of method “dispalyDigits()”.
      • Declare the required variables.
      • Traverse the loop till “i” reaches “num”.
        • Assign “i” to “div”.
      • Check the condition “div” is greater than “1”.
        • Call the method “quotient()”.
        • Calculate the result.
        • Call the method quotient.
      • Print the result.

Blurred answer
Students have asked these similar questions
C# n Chapter 6, you continued to modify the GreenvilleRevenue program. Now, modify the program so that the major functions appear in the following individual methods: GetContestantNumber - This method gets and returns a valid number of contestants and is called twice once for last year’s number of contestants and once for this year’s value DisplayRelationship - This method accepts the number of contestants this year and last year and displays one of the three messages that describes the relationship between the two contestant values GetContestantData - This method fills the array of competitors and their talent codes GetLists - This method continuously prompts for talent codes and displays contestants with the corresponding talent until a sentinel value is entered An example of the program is shown below: Enter number of contestants last year >> 2 Enter number of contestants this year >> 3 Last year's competition had 2 contestants, and this year's has 3 contestants…
Financial Application:• Write a program that computes future investment value at a given interest rate for aspecified number of months and prints the report shown in the sample output. • Given the annual interest rate, the interest amount earned each month is computedusing the formula: Interest earned = investment amount * annual interest rate /1200 (=months * 100) • Write a method, computeFutureValue, which receives the investment amount, annualinterest rate and number of months as parameters and does the following: o Prints the interest amount earned each month and the new value of theinvestment (hint: use a loop). o Returns the total interest amount earned after the number of months specified bythe user. The main method will:o Ask the user for all input needed to call the computeFutureValue method.o Call computeFutureValueo Print the total interest amount earned by the investment at the end of thenumber of months entered by the user. Sample Program runningEnter the investment…
Java Programming Travel Tickets Company sells tickets for airlines, tours, and other travel-related services. Because ticket agents frequently mistype long ticket numbers, Travel Tickets has asked you to write an application that indicates invalid ticket number entries. The class prompts a ticket agent to enter a six-digit ticket number. Ticket numbers are designed so that if you drop the last digit of the number, then divide the number by 7, the remainder of the division will be identical to the last dropped digit. This process is illustrated in the following example: Step 1. Enter the ticket number; for example, 123454. Step 2. Remove the last digit, leaving 12345. Step 3. Determine the remainder when the ticket number is divided by 7. In this case, 12345 divided by 7 leaves a remainder of 4. Step 4. Assign the Boolean value of the comparison between the remainder and the digit dropped from the ticket number. Step 5. Display the result—true or false—in a message box. Accept the…

Chapter 6 Solutions

Java How to Program, Early Objects (11th Edition) (Deitel: How to Program)

Ch. 6 - Prob. 1.11SRECh. 6 - Prob. 1.12SRECh. 6 - For the class Craps in Fig. 6.8, state the scope...Ch. 6 - the variable die1.Ch. 6 - the method rollDice.Ch. 6 - Prob. 2.4SRECh. 6 - Prob. 2.5SRECh. 6 - Write an application that tests whether the...Ch. 6 - Prob. 4.1SRECh. 6 - Method smallest, which takes three integers x, y...Ch. 6 - Prob. 4.3SRECh. 6 - Method intToFloat, which takes integer argument...Ch. 6 - Find the error in each of the following program...Ch. 6 - 1 int sum(int x, int y) { 2 int result; 3 result =...Ch. 6 - 1 void f(float a); { 2 float a; 3...Ch. 6 - 1 void product() { 2int, a = 6; 3int b = 5; 4int c...Ch. 6 - Declare method sphereVolume to calculate and...Ch. 6 - What is the value of x after each of the following...Ch. 6 - What is the value of x after each of the following...Ch. 6 - What is the value of x after each of the following...Ch. 6 - What is the value of x after each of the following...Ch. 6 - What is the value of x after each of the following...Ch. 6 - What is the value of x after each of the following...Ch. 6 - What is the value of x after each of the following...Ch. 6 - (Parking Charges) A parking garage charges a 2.00...Ch. 6 - (Rounding Numbers) Math.floor can be used to round...Ch. 6 - To round numbers to specific decimal places, use a...Ch. 6 - Prob. 5.1ECh. 6 - Write statements that assign random integers to...Ch. 6 - Write statements that will display a random number...Ch. 6 - (Exponentiation) Write a method integer Power...Ch. 6 - Define a method hypotenuse that calculates the...Ch. 6 - Prob. 10.1ECh. 6 - Prob. 11.1ECh. 6 - (Displaying a Square of Asterisks) Write a method...Ch. 6 - (Displaying a Square of Any Character) Modify the...Ch. 6 - Prob. 14.1ECh. 6 - (Separating Digits) Write methods that accomplish...Ch. 6 - (Separating Digits) Write methods that accomplish...Ch. 6 - Prob. 15.3ECh. 6 - (Temperature Conversions) Implement the following...Ch. 6 - Method fahrenheit returns the Fahrenheit...Ch. 6 - Prob. 16.3ECh. 6 - (Find the Minimum) Write a method minimum3 that...Ch. 6 - Prob. 18.1ECh. 6 - (Prime Numbers) A positive integer is prime if its...Ch. 6 - Prob. 20.1ECh. 6 - (Greatest Common Divisor) The greatest common...Ch. 6 - Write a method qualityPoints that inputs a...Ch. 6 - Write an application that simulates coin tossing....Ch. 6 - (Guess the Number) Write an application that plays...Ch. 6 - Prob. 25.1ECh. 6 - Prob. 26.1ECh. 6 - (Craps Game Modification) Modify the craps program...Ch. 6 - (Table of Binary, Octal and Hexadecimal Numbers)...Ch. 6 - (Computer-Assisted Instruction) The use of...Ch. 6 - Prob. 2MDCh. 6 - Prob. 3MDCh. 6 - (Computer-Assisted Instruction: Difficulty Levels)...
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
  • Text book image
    EBK JAVA PROGRAMMING
    Computer Science
    ISBN:9781305480537
    Author:FARRELL
    Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT