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]
4 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]4 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
The yield strength of mild steel is 150 MPa for an average grain diameter of 0.038 mm ; yield strength is 250 MPa for average gr
djyliett [7]

Answer:

Explanation:

Hall-Petch equation provides direct relations between the strength of the material and the grain size:

σ=σ0+k/√d , where d- grain size, σ- strength for the given gran size, σ0 and k are the equation constants.

As in this problem, we don't know the constants of the equation, but we know two properties of the material, we are able to find them from the system of equations:

σ1=σ0+k/√d1

σ2=σ0+k/√d2 , where 1 and 2 represent 150MPa and 250MPa strength of the steel.

Note, that for the given problem, there is no need to convert units to SI, as constants can have any units, which are convenient for us.

From the system of equations calculations, we can find constant: σ0=55.196 MPa, k=18.48 MPa*mm^(0.5)

Now we are able to calculate strength for the grain diameter of 0.004 mm:

σ=55.196+18.48/(√0.004)=347.39 MPa

The strength of the steel with the grais size of 0.004 mm is 347.39 MPa.

6 0
4 years ago
100000000000x1000000000000=?
zhannawk [14.2K]

Answer:

Thy answer to your very sophisticated question is 1E23

Explanation:

IT JUST IS! Dont ask any questions

mAsquErade, mAsquerade tHat iS mY naME

7 0
2 years ago
Read 2 more answers
Coils of various dimensions designed to introduce specified amounts of inductance into a circuit are called (a) semiconductors (
Delicious77 [7]

Answer: d) Inductors

Explanation:  Inductors are the electric component commonly known by the name of coils as well. The work done by inductors is when the electric current flows through the coils of the wire then there is production of the magnetic field. They are the component that have the inductance in particular amount according to the circuit.So, coils of various dimensions are designed to introduce specified amount of inductance  into a circuit are called inductors.

4 0
3 years ago
How do I put a picture on here for my graph equation??
Pavel [41]

Answer:

Take a screenshot of it and when you go to question you will see a paperclip looking thing

Explanation:

8 0
4 years ago
Read 2 more answers
Critical Thinking Scenario The Vice President for Compliance Management, Alexander Goodenuff, supports the position taken by Hen
Kisachek [45]

Answer:

True, True

Explanation:

1st Scenario: Purchase of new contamination equipment would indicate that the plant had been violating environmental regulations and reporting false data. So, Cathy and Henry must not purchase and install new contamination equipment unless the data indicates serious violatino of environmental regulations.

2nd Scenario: Company has the responsibiltiy to report contamination in plant water to regulatory agencies and Cathy Martin has been assigned this responsibility to report on behalf of the company. Reporting "adjusted" or inaccurate data is against the business ethics. So, professionally Cathy Martin is responsible for her reports to regulatory agencies.

8 0
3 years ago
Other questions:
  • Steam flows at steady state through a converging, insulated nozzle, 25 cm long and with an inlet diameter of 5 cm. At the nozzle
    11·1 answer
  • A pump is put into service at the coast where the barometric pressure is 760 mm Hg. The conditions of service are : Flow rate 0,
    11·1 answer
  • What is the entropy of a closed system in which 25 distinguishable grains of sand are distributed among 1000 distinguishable equ
    5·2 answers
  • If outside of the flask is not dry when first determination is made and it is dried for second determination, what effect will t
    15·1 answer
  • Determine the average power, complex power and power factor (including whether it is leading or lagging) for a load circuit whos
    9·2 answers
  • Water enters the tubes of a cold plate at 70°F with an average velocity of 40 ft/min and leaves at 105°F. The diameter of the tu
    8·1 answer
  • Challenge:
    5·1 answer
  • there are 17 toinspect in a commercial building. Each inspection takes 40 min. How many will the full inspection take
    9·1 answer
  • Calculate area moment of inertia for a circular cross section with 6 mm diameter
    7·1 answer
  • The only difference between all GMA welding machines and some FCA welding machines is that all GMA welding machines must have a
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!