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
Carbon resistors often come as a brown cylinder with colored bands. These colored bands can be read to determine the manufacture
alexandr1967 [171]

Answer:

a) 4.7 kΩ, +/- 5%

b) 2.0 MΩ, +/- 20%

Explanation:

a) If the resistor has the following combination of color bands:

1) Yellow = 1st digit = 4

2) Violet = 2nd digit = 7

3) Red = multiplier = 10e2

4) Gold = tolerance = +/- 5%

this means that the resistor has 4700 Ω (or 4.7 kΩ), with 5% tolerance.

b) Repeating the process for the following combination of color bands:

1)  Red = 1st digit = 2

2) Black = 2nd digit = 0

3) Green = multiplier = 10e5

4) Nothing = tolerance = +/- 20%

This combination represents to a resistor of 2*10⁶ Ω (or 2.0 MΩ), with +/- 20% tolerance.

7 0
3 years ago
Define the coefficient of determination and discuss the impact you would expect it to have on your engineering decision-making b
scoundrel [369]

Answer and Explanation:

The coefficient of determination also called "goodness of fit" or R-squared(R²) is used in statistical measurements to understand the relationship between two variables such that changes in one variable affects the other. The level of relationship or the degree to which one affects the other is measured by 0 to 1 whereby 0 means no relationship at all and 1 means one totally affects the other while figures in between such 0.40 would mean one variable affects 40% of the other variable.

In making a decision as an engineer while using the coefficient of determination, one would try to understand the relationship between variables under consideration and make decisions based on figures obtained from calculating coefficient of determination. In other words when there is a 0 coefficient then there is no relationship between variables and an engineer would make his decisions with this in mind and vice versa.

7 0
3 years ago
15 POINTS! Help.
IRISSAK [1]

Answer: it would  overload

Explanation:

4 0
2 years ago
Read 2 more answers
Set up the following characteristic equations in the form suited to Evanss root-locus method. Give L(s), a(s), and b(s) and the
Sunny_sXe [5.5K]

Answer:

attached below is the detailed solution and answers

Explanation:

Attached below is the detailed solution

C(iii) : versus the parameter C

The parameter C is centered in a nonlinear equation, therefore the standard locus will not apply hence when you use a polynomial solver the roots gotten would be plotted against C

4 0
3 years ago
A construction crew lifts approximately 400 lb. of material several times during a day from a flatbed truck to a 25 ft. rooftop.
Irina18 [472]

Answer:

2ib

Explanation:

if you divide 10 divided by 2 it gives you 5 and then subtract it by 2.2 = 2.8

there goes your answer.

5 0
2 years ago
Other questions:
  • - The four leading causes of death in the
    5·2 answers
  • A cylindrical specimen of this alloy 12.7 mm in diameter and 250 mm long is stressed in tension and found to elongate 7.6 mm. On
    5·1 answer
  • A steam reformer operating at 650C and 1 atm uses propane as fuel for hydrogen production. At the given operating conditions, th
    12·1 answer
  • Que es resistencia ?
    15·1 answer
  • Discuss the chemical and physical properties of crude oil​
    6·1 answer
  • When a conductor is moved in a magnetic field, a voltage will be induced on the conductor. However, current won't flow through t
    11·1 answer
  • Python lists are commonly used to store data types. Lists are a collection of information typically called a container. Think of
    5·1 answer
  • Which one of these is not a successful budgeting strategy
    5·2 answers
  • Which fields of engineering use fluid power? Explain how these fields make use of fluid power systems: water supply, agricultura
    10·1 answer
  • T/f
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!