by CodeChum Admin
Let's play a game of FizzBuzz! It works just like the popular childhood game "PopCorn", but with rules of math applied since math is fun, right?
Just print out "Fizz" when the given number is divisible by 3, "Buzz" when it's divisible by 5, and "FizzBuzz" when it's divisible by both 3 and 5!
number of computers sold per day at a local computer store are 0,1,2,3, and 4 with the probabilities 0.1, 0.2, 0.3, 0.2, and 0.2 respectively. Find the variance and standard deviation of the distribution
To give you direction:
Example:
2
4
7
5
the output will be 2 it is the first prime number.
the code which you have sent did not the get the desired output
Write a program that uses one or more if statements to solve the following problem:
Prompt the user for a number (type double) and the type of conversion calculation to apply. Once the user supplies the value and the type of conversion, your program should apply the appropriate conversion and display the result. For the conversion type, the user will enter one of the following conversion conversion codes: GL, IC, PK, MK.
Based on the user's input, your program will compute and display the appropriate result. See below for the meaning of the codes:
GL = Gallon to Liter
IC = Inch to Centimeter
PK = Pound to Kilogram
MK = Mile to Kilometer
For instance, if the user inputs GL as their conversion type, the program will then take their numeric input as gallons and converrt it to liters. The liters value would then be output to the user. Please find some additional information below to assist you in solving this problem:
Write a program that asks the user to enter a distance in meters. The program will then present the following menu of selections:
1. Convert to kilometers
2. Convert to inches
3. Convert to feet
4. Quit the program
Here is an example session with the program, using console input. The user’s input is shown in bold.
Enter a distance in meters: 500 [enter]
1. Convert to kilometers
2. Convert to inches
3. Convert to feet
4. Quit the program
Enter your choice: 1 [enter]
500 meters is 0.5 kilometers.
1. Convert to kilometers
2. Convert to inches
3. Convert to feet
4. Quit the program
Enter your choice: 3 [enter]
500 meters is 1640.5 feet.
1. Convert to kilometers
2. Convert to inches
3. Convert to feet
4. Quit the program
Enter your choice: 4 [enter]
Bye!
A painting company has determined that for every 115 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges P120.00 per hour for labor. Write a program that allows the user to enter the number of rooms to be painted and the price of the paint per gallon. It should also ask for the square feet of wall space in each room. The program should have functions that return the following data:
· The number of gallons of paint required
· The hours of labor required
· The cost of the paint
· The labor charges
· The total cost of the paint job
Then it should display the data on the screen.
A prime number is a number that is evenly divisible only by itself and 1. For example, the number 5 is prime because it can be evenly divided only by 1 and 5. The number 6, however, is not prime because it can be divided evenly by 1, 2, 3, and 6. Write a C++ program using a function that takes an integer as an argument and returns true if the argument is a prime number, or false otherwise. Demonstrate the function in a complete C++ program.
A small sphere of charge +6×10^-6 C is suspended by a string of negligible mass. A charge of -9.0×10^-6 C is placed directly to the right of the sphere and 0.22m away from it. The string is deflected 5^0 from the vertical. Find the tension in the string.
A ball is thrown vertically upwards with an initial velocity of 30 m/s.
Using a time step of 0.02 s up to 6.20 s, write a matlab code to give a plot of the vertical distance versus
time for this ball.
Hint ; Motion under gravity is described by the equation : 𝑣𝑦 = 𝑣𝑜𝑦𝑡 +1/2𝑔𝑡²
and gravitational acceleration 𝑔 is here taken as negative.
If a water wave with length L moves with a velocity 𝑣 across a body of water with depth d, as in figure below,
then
𝑣2 = 𝑔𝐿 tanh 2𝜋𝑑, 2𝜋 𝐿
a) If the water is deep, show that 𝑣 ≈ √𝑔𝐿. 2𝜋
b) If the water is shallow, use the Maclaurin series for tanh to show that 𝑣 ≈ √𝑔𝑑. (Thus, in shallow water the velocity of a wave tends to be independent of the length of the wave.)