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
Input Energy ---> Output Energy
uranmaximum [27]

Answer:

motion ------> electrical. winds push the turbines which generate a magnetic fields which in turn, generates electricity

4 0
3 years ago
List five areas that increased energy prices impact.
Effectus [21]

Answer:

Supply, demand, global markets, imports and exports, and government Regulation.

Explanation:

7 0
3 years ago
The mass flow rate in a 4.0-m wide, 2.0-m deep channel is 4000 kg/s of water. If the velocity distribution in the channel is lin
IceJOKER [234]

Answer:

V = 0.5 m/s

Explanation:

given data:

width of channel =  4 m

depth of channel = 2 m

mass flow rate = 4000 kg/s = 4 m3/s

we know that mass flow rate is given as

\dot{m}=\rho AV

Putting all the value to get the velocity of the flow

\frac{\dot{m}}{\rho A} = V

V = \frac{4000}{1000*4*2}

V = 0.5 m/s

4 0
3 years ago
Plzzzz helppp design process in order
MA_775_DIABLO [31]

Answer:

generate

define

present

evaluate

develop

construct and test

7 0
3 years ago
At a certain location, wind is blowing steadily at 5 mph. Suppose that the mass density of air is 0.0796 lbm/ft3 and determine t
nlexa [21]

Answer:

The radius of a wind turbine is 691.1 ft

The power generation potential (PGP) scales with speed at the rate of 7.73 kW.s/m

Explanation:

Given;

power generation potential (PGP) = 1000 kW

Wind speed = 5 mph = 2.2352 m/s

Density of air = 0.0796 lbm/ft³ = 1.275 kg/m³

Radius of the wind turbine r = ?

Wind energy per unit mass of air, e = E/m = 0.5 v² = (0.5)(2.2352)²

Wind energy per unit mass of air = 2.517 J/kg

PGP = mass flow rate * energy per unit mass

PGP = ρ*A*V*e

PGP = \rho *\frac{\pi r^2}{2} *V*e  \\\\r^2 = \frac{2*PGP}{\rho*\pi *V*e} , r=\sqrt{ \frac{2*PGP}{\rho*\pi *V*e}} = \sqrt{ \frac{2*10^6}{1.275*\pi *2.235*2.517}}

r = 210.64 m = 691.1 ft

Thus, the radius of a wind turbine is 691.1 ft

PGP = CVᵃ

For best design of wind turbine Betz limit (c) is taken between (0.35 - 0.45)

Let C = 0.4

PGP = Cvᵃ

take log of both sides

ln(PGP) = a*ln(CV)

a = ln(PGP)/ln(CV)

a = ln(1000)/ln(0.4 *2.2352) = 7.73

The power generation potential (PGP) scales with speed at the rate of 7.73 kW.s/m

5 0
3 years ago
Other questions:
  • NASA SPACE SHUTTLE QUESTION:
    14·1 answer
  • 3. (20 points) Suppose we wish to search a linked list of length n, where each element contains a key k along with a hash value
    7·1 answer
  • A frequenter of a pub had observed that the new barman poured in average 0.47 liters of beer into the glass with a standard devi
    14·1 answer
  • What's the best way to plan an organized​
    7·1 answer
  • A battery with an f.e.m. of 12 V and negligible internal resistance is connected to a resistor of 545 How much energy is dissipa
    9·1 answer
  • Yall know what this is called?​
    15·1 answer
  • Witch measuring tool would be used to determine the diameter of a crankshaft journal
    5·1 answer
  • You are coming to this intersection, and are planning on turningright. There is a vehicle close behind you. You should?
    15·1 answer
  • Why not just put all the set up steps within each step? it is because we want to keep our code __ ? (3 letters)
    11·1 answer
  • when discussing valve train components, technician a says stamped rocker arms are very strong and may be used in high-horsepower
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!