Create a class, and define variables in main(): a) double variable “var_d” and initialize it to the value 1.0898
- Create a class, and define variables in main():
a) double variable “var_d” and initialize it to the value 1.0898
b) float variable “var_f” and initialize it to the value -1.0862
c) int variable “var_i” and initialize it to the value -10000
d) short variable “var_l” and initialize it to the value 99990 - Write a program to define 2 int variables vx & vy. Initialize them with value 0; Use
Scanner object to read from console and assign input values to them respectively.
Display the values in the format: vx=some-value; vy=some-value. Then swap
values in vx and vy, and display again. - Write a program to “left rotate” and “right rotate” values in int variables x, y, z, w
(Example: if x = 1, y = 2, z = 3, z = 4,
after left rotation, x = 2, y = 3, z = 4, w = 1
after right rotation, x = 4, y = 1, z = 2, w = 3) - Write a program to calculate the area of a rectangle. You should use Scanner to get
values of width and height; then calculate the area; and finally display the width,
height and the area of this rectangle. - Write a program to get from console a number which represents seconds. Convert
this number of seconds to the format: ?? hours : ?? minutes : ?? seconds and display.
For example, if you input 4000, you will display message on console:
4000 seconds = 1 hours : 6 minutes : 40 seconds - Write a program to reads a double number from console using Scanner object, save
this number into variable celsiusDegree, which represents Celsius degree. Convert
this number to Fahrenheit degree and display both numbers on console as below:
Celsius degree: a-celsius-number
Fahrenheit degree: a-fahrenheit-number - Write a program to calculate the volume of cone (refer below graph and formula.)
Read number of h from console. This number is measured in feet (1 feet = 0.305
meters), convert it to meter, calculate and display the result:
The post Create a class, and define variables in main(): a) double variable “var_d” and initialize it to the value 1.0898 appeared first on Vivanswers.org.