1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Novosadov [1.4K]
3 years ago
6

This assignment will give you more experience on the use of loops In this project, we are going to compute the number of times a

given digit D appears in a given number N. For example, the number of times 5 appears in 1550 is 2. The number of times 0 appears in 1550 is 1. The number of times 3 appears in 155 is 0. Etc.
Engineering
1 answer:
musickatia [10]3 years ago
3 0

Answer:

import java.io.BufferedReader;

import java.io.File;

import java.io.FileReader;

import java.io.IOException;

import java.util.Scanner;

import java.util.StringTokenizer;

public class Tester {

public static void main(String[] args) throws IOException {

Scanner in=new Scanner(System.in);

   System.out.println("Enter a Number =======>");

   long N ;

   while (!in.hasNextLong()) {

       System.out.println("That's not a number!");

       in.next();

   }

   N=in.nextLong();

   System.out.println("Number Entered is =======>"+N);

   System.out.println("Enter a Digit =======>");

   int D;

   while (!in.hasNextLong()) {

       System.out.println("That's not a number!");

       in.next();

   }

   D=in.nextInt();

   System.out.println("Digit Entered is =======> "+ D);

   long que=N;

   int rem;

   int count=0;

   while(true){

       long temp;

       temp = (long)que/10;

       

       rem = (int) (que % 10);

       System.out.println(temp+" "+ que+" "+rem);

       if(rem==D) count++;

       que=temp;

       if(que==0) break;

       

   }

   System.out.println("The number of "+ D+"'s in "+ N + " is "+ count );;

   

   

}

}

Explanation:

  • Divide the que variable by 10 and assign its result to the temp variable.
  • Calculate the remainder.
  • Increment the count if the remainder is equal to the value of D variable and assign the value of que to temp variable.
You might be interested in
List and describe three classifications of burns to the body.
DiKsa [7]

AnswerWhat Are the Classifications of Burns? Burns are classified as first-, second-, or third-degree, depending on how deep and severe they penetrate the skin's surface. First-degree burns affect only the epidermis, or outer layer of skin. The burn site is red, painful, dry, and with no blisters.

Explanation:

8 0
3 years ago
Read 2 more answers
What different tests did the team perform to come up with a workable design?
I am Lyosha [343]
They ran different shapes and materials through a wind tunnel to see which shape and material would decrease energy output so that it takes in equal COthan it puts out.
5 0
3 years ago
A steel bolt has a modulus of 207 GPa. It holds two rigid plates together at a high temperature under conditions where the creep
VikaD [51]

Answer:

14.36((14MPa) approximately

Explanation:

In this question, we are asked to calculate the stress tightened in a bolt to a stress of 69MPa.

Please check attachment for complete solution and step by step explanation

7 0
3 years ago
3<br> Current is measured in units called
bixtya [17]

Answer:

current is measured in Ampere (A)

6 0
2 years ago
Read 2 more answers
A fatigue test was conducted in which the mean stress was 90 MPa (13050 psi), and the stress amplitude was 190 MPa (27560 psi).
Gwar [14]

Answer:

a) 280MPa

b) -100MPa

c) -0.35

d) 380 MPa

Explanation:

GIVEN DATA:

mean stress \sigma_m = 90MPa

stress amplitude \sigma_a = 190MPa

a) \sigma_m =\frac{\sigma_max+\sigma_min}{2}

    90 =\frac{\sigma_{max}+\sigma_{min}}{2} --------------1

\sigma_a =\frac{\sigma_{max}-\sigma_{min}}{2}

   190 = \frac{\sigma_{max}-\sigma_{min}}{2} -----------2

solving 1 and 2 equation we get

\sigma_{max} = 280MPa

b) \sigma_{min} = - 100MPa

c)

stress ratio=\frac{\sigma_{min}}{\sigma_{max}}

=\frac{-100}{280} = -0.35

d)magnitude of stress range

                      =(\sigma_{max} -\sigma_{min})

                       = 280 -(-100) = 380 MPa

3 0
3 years ago
Other questions:
  • The dry unit weight of a soil sample is 14.8 kN/m3.
    12·1 answer
  • A evolução da malha rodoviária do Brasil é um marco notável
    9·1 answer
  • For a steel alloy it has been determined that a carburizing heat treatment of 7 hour duration will raise the carbon concentratio
    12·1 answer
  • Calculate the reactions at 4 ends (supports) of this bookshelf. Assume that the weight of each book is approximately 1 lb. The w
    13·1 answer
  • A power of 100 kW (105 W) is delivered to the other side of a city by a pair of power lines, between which the voltage is 12,000
    9·1 answer
  • You are traveling along an interstate highway at 32.0 m/s (about 72 mph) when a truck stops suddenly in front of you. You immedi
    11·1 answer
  • ¿Cómo nos podría ayudar una hoja de cálculo en nuestro estudio?
    11·1 answer
  • A total of 245 kip force is applied to a set of 10 similar bolts. If the spring constant of each bolt is 0.4 Mlb/in and that of
    9·1 answer
  • I am sending an email to my teacher. Is this mature enough?
    15·2 answers
  • Who wanna rp?????????????????????????!
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!