Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab Exercises: All in the java programming language. Provide a screenshot of the output please for each program please. Write a program to accept a

Lab Exercises: All in the java programming language. Provide a screenshot of the output please for each program please.

  1. Write a program to accept a number and display the all natural numbers below that number. (Hint: If you enter 5, result is :1+2+3+4+5=15)

  1. Write a program to find the factorial of a given number.

(Hint: if you enter 5, Result: 120).

  1. Write a program to accept a number and display all prime numbers below that number. (Hint : If you enter 10, Result should be :2, 3,5,7)

  1. Write a program to accept a number and display the multiplication table of that number.

  1. The two temperature scales used in the United States are Celsius and Fahrenheit. The mathematical relationship between the two scales is:

C=5/9(F32)

Write two functions, fToC and cToF, which convert temperatures from one scale to another. For example, a call of fToC will return the equivalent Celsius temperature for a given Fahrenheit temperature.

Celsius = fToC (100); // Celsius now stores 37.8

  1. Write a function which takes in the radius of a sphere and calculate its area and its volume. The formula is:

V= 4/3 r3

You are encouraged to use the predefined method ( PI ) for the value of p .

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

Students also viewed these Databases questions