Java – Celsius to Fahrenheit
Write a Java program to convert a Celsius value of 18.9 to Fahrenheit.
Use given code to convert 18.9 degrees Celsius to degrees Fahrenheit. Modify by changing app name and record any errors.
Screens
Calculate Area of a Circle
Write a java program to calculate the area of a circle with a radius of 10.
– Write a java program to calculate the area of a circle with a radius of 10. – Compile and Run your program.
– Declare variables: pi, radius and theArea – Process – calculate the Area using: pi * (radius * radius) formula
– Output – print result of the calculation
Add 9 and 91
Using the area of a circle program as a template change the code to ADD the following two integers together. The first integer will have a value of 9 and the second 91.
Calculate Area of a Rectangle
Using the area of a circle program as a template, change the code to calculate the area of a rectangle where the sides of the rectangle are 70 and 10.
Area of a Rectangle > 40 m2
Develop a program that calculates the area of a rectangle area = length * breadth. If the area is greater than 40 meters print one thing, otherwise print something else.
– Write a program which calculates the area of a rectangle using formula area = length * breadth. – If the area is greater than 40 meters squared print out “This rectangle is too big, it has a length of xxx and breath of xxxx please reduce one of the values.” – Otherwise printout “this rectangle will fit, the length you entered was xxxx, the breath was xxxxx. The area of the triangle will be xxxxxx”
Verify Size of an Area of a Rectangle
Based on lab 3.1, Area < 20 print too small, Area > 20 and Area < 40 print perfect size, Area > 40 and Area < 60 print too big.
– Use arithmetic expressions with constants. – Use nested IF ELSE
Program Printing Out Numbers
Create a program to print out numbers from 8 to 80 in steps of 2
– Use arithmetic expressions with constants. – Use a WHILE loop
Program Printing Out the Prime Numbers
Create a program to print out the prime numbers between the numbers 1 to 100.
– Generate prime numbers between 1 and 100 – A prime number has no positive divisors other than 1 and itself – 1 is not a prime number
The program starts with number 2 and checks each number 3,4,5, and so forth. Each time it finds a prime it prints the number and increments by 1. When the number hits 100, it stops the process. To determine whether a number is prime, it divides number to check if it gives a reminder. For each number in the loop a boolean isPrimeNumber is equal to true. If the number has no reminder, then the boolean isPrimeNumber is set to false. It prints number if boolean isPrimeNumber = true.
Program That Reads in 10 Numbers
Create a program that uses the Scanner library to reads in 10 numbers between 10 and 30.
– Create a program that uses the Scanner library to reads in 10 numbers between 10 and 30. – Once all 10 numbers are displayed the average of the 10 numbers is calculated and displayed. – If an invalid number is entered e.g. a number not between 10 and 30 then the user is asked to re-enter a valid number. – The invalid entry is not counted as one of the 10 entries.
Program Calculating Area of a Rectangle
– Develop a program that calculates the area of a rectangle: area = length * breadth.
– Use the javabook class library InputBox class to ask the user for the length and breath.
– Display the results using the OutputBox class
– Program that input and output data using the Javabook InputBox and OutputBox classes.
– Use arithmetic expressions.
Program Converting Celsius to Fahrenheit
– Write a program that converts temperatures from Celsius to Fahrenheit
– Fahrenheit = 1.8 * Celsius + 32 (1.8 and 32 are defined as constants).
– Use the javabook class library InputBox class to ask the user for the Celsius value to be converted.
–Display the results using the OutputBox class.
– Implement constants – 1.8 and 32 are defined as constants.
– Write arithmetic expressions with constants.
– Input: user input in Celsius degree.
– Processing: arithmetic expressions with constants.
– Output: display the result using the OutputBox class.
Program Calculating Area of a Circle
– Write a program that calculates the area of a Circle.
– Use the javabook class library InputBox class to ask the user for the radius of the circle.
– Use the built in Java Maths library.
– Display the results using the OutputBox class.
– Area = π r2.
– Use the Maths library to obtain a value for π.
– Calculate the power of r2 using the pow() function.
– Use the javabook class library InputBox class to ask the user for the radius of the circle.
– Display the results using the OutputBox class.
Calculating an Average of Three Numbers
Develop a program that asks the user to input 3 numbers and then returns the average of the 3 numbers.
– Users input: 3 numbers
– Output: average of the 3 numbers
–Use the javabook class library InputBox class to ask the user for each number.
– Display the results using the OutputBox class.
Throwing of a Dice
Develop a program that when run simulates the throwing of a dice.
– Simulation of the throwing of a dice
–Display the results using the OutputBox class.