SlideShare une entreprise Scribd logo
1  sur  3
Télécharger pour lire hors ligne
import java.util.Scanner;
public class Calculation {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("Welcome to the Calcuation Program!");
System.out.println("1. Area of a circle");
System.out.println("2. Volume of a sphere");
System.out.println("3. Volume of a cylindrical solid");
System.out.println("4. Fahrenheit to Celsius conversion");
System.out.print("Select a calculation:");
int choice=sc.nextInt();
if(choice==1){
System.out.print("Enter the radius:");
double rad=sc.nextDouble();
System.out.println();
System.out.printf("The area of the circle with radius %.2f units is %.2f
units^2",rad,Math.PI*rad*rad);
}
else if(choice==2){
System.out.print("Enter the radius:");
double rad=sc.nextDouble();
System.out.println();
System.out.printf("The volume of sphere with radius %.2f units is %.2f
units^3",rad,(4*Math.PI*rad*rad*rad)/3);
}
else if(choice==3){
System.out.print("Enter the radius:");
double rad=sc.nextDouble();
System.out.print("Enter the height:");
double h=sc.nextDouble();
System.out.println();
System.out.printf("The volume of cylindrical solid with radius %.2f units and height
%.2f units is %.2f units^3",rad,h,Math.PI*rad*rad*h);
}
else if(choice==4){
System.out.print("Enter the temperature in Farenheit:");
double temp=sc.nextDouble();
System.out.println();
System.out.printf("The temperature in Celsius is %.2f",59*(temp-32));
}
}
}
Solution
import java.util.Scanner;
public class Calculation {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
System.out.println("Welcome to the Calcuation Program!");
System.out.println("1. Area of a circle");
System.out.println("2. Volume of a sphere");
System.out.println("3. Volume of a cylindrical solid");
System.out.println("4. Fahrenheit to Celsius conversion");
System.out.print("Select a calculation:");
int choice=sc.nextInt();
if(choice==1){
System.out.print("Enter the radius:");
double rad=sc.nextDouble();
System.out.println();
System.out.printf("The area of the circle with radius %.2f units is %.2f
units^2",rad,Math.PI*rad*rad);
}
else if(choice==2){
System.out.print("Enter the radius:");
double rad=sc.nextDouble();
System.out.println();
System.out.printf("The volume of sphere with radius %.2f units is %.2f
units^3",rad,(4*Math.PI*rad*rad*rad)/3);
}
else if(choice==3){
System.out.print("Enter the radius:");
double rad=sc.nextDouble();
System.out.print("Enter the height:");
double h=sc.nextDouble();
System.out.println();
System.out.printf("The volume of cylindrical solid with radius %.2f units and height
%.2f units is %.2f units^3",rad,h,Math.PI*rad*rad*h);
}
else if(choice==4){
System.out.print("Enter the temperature in Farenheit:");
double temp=sc.nextDouble();
System.out.println();
System.out.printf("The temperature in Celsius is %.2f",59*(temp-32));
}
}
}

Contenu connexe

Similaire à import java.util.Scanner;public class Calculation {   public sta.pdf

(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docxdorisc7
 
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfMagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfanjanacottonmills
 
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdfCircle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdfANJALIENTERPRISES1
 
Write a program Grader that that will be used by a program driver to.pdf
Write a program Grader that that will be used by a program driver to.pdfWrite a program Grader that that will be used by a program driver to.pdf
Write a program Grader that that will be used by a program driver to.pdfarjunenterprises1978
 
Class program and uml in c++
Class program and uml in c++Class program and uml in c++
Class program and uml in c++Osama Al-Mohaia
 

Similaire à import java.util.Scanner;public class Calculation {   public sta.pdf (8)

(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
 
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdfMagicSquareTest.java import java.util.Scanner;public class Mag.pdf
MagicSquareTest.java import java.util.Scanner;public class Mag.pdf
 
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdfCircle.javaimport java.text.DecimalFormat;public class Circle {.pdf
Circle.javaimport java.text.DecimalFormat;public class Circle {.pdf
 
Java Unit 1 Project
Java Unit 1 ProjectJava Unit 1 Project
Java Unit 1 Project
 
Write a program Grader that that will be used by a program driver to.pdf
Write a program Grader that that will be used by a program driver to.pdfWrite a program Grader that that will be used by a program driver to.pdf
Write a program Grader that that will be used by a program driver to.pdf
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
programming for Calculator in java
programming for Calculator in javaprogramming for Calculator in java
programming for Calculator in java
 
Class program and uml in c++
Class program and uml in c++Class program and uml in c++
Class program and uml in c++
 

Plus de anandanand521251

When ionic compounds dissolve in water, they dissociate into ions..pdf
When ionic compounds dissolve in water, they dissociate into ions..pdfWhen ionic compounds dissolve in water, they dissociate into ions..pdf
When ionic compounds dissolve in water, they dissociate into ions..pdfanandanand521251
 
Let the discrete random variable X denote the number of times an ev.pdf
 Let the discrete random variable X denote the number of times an ev.pdf Let the discrete random variable X denote the number of times an ev.pdf
Let the discrete random variable X denote the number of times an ev.pdfanandanand521251
 
Given operation are push, pop, top, isEmptyLets assume that .pdf
 Given operation are push, pop, top, isEmptyLets assume that .pdf Given operation are push, pop, top, isEmptyLets assume that .pdf
Given operation are push, pop, top, isEmptyLets assume that .pdfanandanand521251
 
The reaction of sodium hydroxide with sulfuric ac.pdf
                     The reaction of sodium hydroxide with sulfuric ac.pdf                     The reaction of sodium hydroxide with sulfuric ac.pdf
The reaction of sodium hydroxide with sulfuric ac.pdfanandanand521251
 
What is a constructorAns)A constructor is also type of method whi.pdf
What is a constructorAns)A constructor is also type of method whi.pdfWhat is a constructorAns)A constructor is also type of method whi.pdf
What is a constructorAns)A constructor is also type of method whi.pdfanandanand521251
 
d. The number of moles of O2 would increase. as t.pdf
                     d. The number of moles of O2 would increase. as t.pdf                     d. The number of moles of O2 would increase. as t.pdf
d. The number of moles of O2 would increase. as t.pdfanandanand521251
 
The main difference between DBA and Data Scientists 1) DBA stands.pdf
The main difference between DBA and Data Scientists 1) DBA stands.pdfThe main difference between DBA and Data Scientists 1) DBA stands.pdf
The main difference between DBA and Data Scientists 1) DBA stands.pdfanandanand521251
 
The encoding format of the given decimal numbers are as fallowsFor.pdf
The encoding format of the given decimal numbers are as fallowsFor.pdfThe encoding format of the given decimal numbers are as fallowsFor.pdf
The encoding format of the given decimal numbers are as fallowsFor.pdfanandanand521251
 
Carbon dioxide enters the waters of the ocean by .pdf
                     Carbon dioxide enters the waters of the ocean by .pdf                     Carbon dioxide enters the waters of the ocean by .pdf
Carbon dioxide enters the waters of the ocean by .pdfanandanand521251
 
In computer security, a vulnerability is a weakness which allows an .pdf
In computer security, a vulnerability is a weakness which allows an .pdfIn computer security, a vulnerability is a weakness which allows an .pdf
In computer security, a vulnerability is a weakness which allows an .pdfanandanand521251
 
QuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdf
QuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdfQuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdf
QuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdfanandanand521251
 
Option (E) Pb is the correct answer.This is because lead occurs in.pdf
Option (E) Pb is the correct answer.This is because lead occurs in.pdfOption (E) Pb is the correct answer.This is because lead occurs in.pdf
Option (E) Pb is the correct answer.This is because lead occurs in.pdfanandanand521251
 
NH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdf
NH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdfNH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdf
NH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdfanandanand521251
 
Jessica and Leah bought identical boxes of stationary. Leah used her.pdf
Jessica and Leah bought identical boxes of stationary. Leah used her.pdfJessica and Leah bought identical boxes of stationary. Leah used her.pdf
Jessica and Leah bought identical boxes of stationary. Leah used her.pdfanandanand521251
 
ln e^35applying logarithmic property35 ln eln e = 135 1.pdf
ln e^35applying logarithmic property35 ln eln e = 135  1.pdfln e^35applying logarithmic property35 ln eln e = 135  1.pdf
ln e^35applying logarithmic property35 ln eln e = 135 1.pdfanandanand521251
 
hi,Now its clear,I had gone through all your solution and it is co.pdf
hi,Now its clear,I had gone through all your solution and it is co.pdfhi,Now its clear,I had gone through all your solution and it is co.pdf
hi,Now its clear,I had gone through all your solution and it is co.pdfanandanand521251
 
falsethey have volume but no shapeSolutionfalsethey have v.pdf
falsethey have volume but no shapeSolutionfalsethey have v.pdffalsethey have volume but no shapeSolutionfalsethey have v.pdf
falsethey have volume but no shapeSolutionfalsethey have v.pdfanandanand521251
 
Conc. H2SO4, heatSolutionConc. H2SO4, heat.pdf
Conc. H2SO4, heatSolutionConc. H2SO4, heat.pdfConc. H2SO4, heatSolutionConc. H2SO4, heat.pdf
Conc. H2SO4, heatSolutionConc. H2SO4, heat.pdfanandanand521251
 
C is correct. The Data Link layer is responsible for encapsulation, .pdf
C is correct. The Data Link layer is responsible for encapsulation, .pdfC is correct. The Data Link layer is responsible for encapsulation, .pdf
C is correct. The Data Link layer is responsible for encapsulation, .pdfanandanand521251
 
AnswerThe hormones and structuresorgansPituitary glandFemal.pdf
AnswerThe hormones and structuresorgansPituitary glandFemal.pdfAnswerThe hormones and structuresorgansPituitary glandFemal.pdf
AnswerThe hormones and structuresorgansPituitary glandFemal.pdfanandanand521251
 

Plus de anandanand521251 (20)

When ionic compounds dissolve in water, they dissociate into ions..pdf
When ionic compounds dissolve in water, they dissociate into ions..pdfWhen ionic compounds dissolve in water, they dissociate into ions..pdf
When ionic compounds dissolve in water, they dissociate into ions..pdf
 
Let the discrete random variable X denote the number of times an ev.pdf
 Let the discrete random variable X denote the number of times an ev.pdf Let the discrete random variable X denote the number of times an ev.pdf
Let the discrete random variable X denote the number of times an ev.pdf
 
Given operation are push, pop, top, isEmptyLets assume that .pdf
 Given operation are push, pop, top, isEmptyLets assume that .pdf Given operation are push, pop, top, isEmptyLets assume that .pdf
Given operation are push, pop, top, isEmptyLets assume that .pdf
 
The reaction of sodium hydroxide with sulfuric ac.pdf
                     The reaction of sodium hydroxide with sulfuric ac.pdf                     The reaction of sodium hydroxide with sulfuric ac.pdf
The reaction of sodium hydroxide with sulfuric ac.pdf
 
What is a constructorAns)A constructor is also type of method whi.pdf
What is a constructorAns)A constructor is also type of method whi.pdfWhat is a constructorAns)A constructor is also type of method whi.pdf
What is a constructorAns)A constructor is also type of method whi.pdf
 
d. The number of moles of O2 would increase. as t.pdf
                     d. The number of moles of O2 would increase. as t.pdf                     d. The number of moles of O2 would increase. as t.pdf
d. The number of moles of O2 would increase. as t.pdf
 
The main difference between DBA and Data Scientists 1) DBA stands.pdf
The main difference between DBA and Data Scientists 1) DBA stands.pdfThe main difference between DBA and Data Scientists 1) DBA stands.pdf
The main difference between DBA and Data Scientists 1) DBA stands.pdf
 
The encoding format of the given decimal numbers are as fallowsFor.pdf
The encoding format of the given decimal numbers are as fallowsFor.pdfThe encoding format of the given decimal numbers are as fallowsFor.pdf
The encoding format of the given decimal numbers are as fallowsFor.pdf
 
Carbon dioxide enters the waters of the ocean by .pdf
                     Carbon dioxide enters the waters of the ocean by .pdf                     Carbon dioxide enters the waters of the ocean by .pdf
Carbon dioxide enters the waters of the ocean by .pdf
 
In computer security, a vulnerability is a weakness which allows an .pdf
In computer security, a vulnerability is a weakness which allows an .pdfIn computer security, a vulnerability is a weakness which allows an .pdf
In computer security, a vulnerability is a weakness which allows an .pdf
 
QuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdf
QuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdfQuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdf
QuestionEvaluate lim as x approaches infinity 2x-11+2xSolution.pdf
 
Option (E) Pb is the correct answer.This is because lead occurs in.pdf
Option (E) Pb is the correct answer.This is because lead occurs in.pdfOption (E) Pb is the correct answer.This is because lead occurs in.pdf
Option (E) Pb is the correct answer.This is because lead occurs in.pdf
 
NH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdf
NH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdfNH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdf
NH4+ is acid as it give a proton tobecome NH3, a baseNO2- is a bas.pdf
 
Jessica and Leah bought identical boxes of stationary. Leah used her.pdf
Jessica and Leah bought identical boxes of stationary. Leah used her.pdfJessica and Leah bought identical boxes of stationary. Leah used her.pdf
Jessica and Leah bought identical boxes of stationary. Leah used her.pdf
 
ln e^35applying logarithmic property35 ln eln e = 135 1.pdf
ln e^35applying logarithmic property35 ln eln e = 135  1.pdfln e^35applying logarithmic property35 ln eln e = 135  1.pdf
ln e^35applying logarithmic property35 ln eln e = 135 1.pdf
 
hi,Now its clear,I had gone through all your solution and it is co.pdf
hi,Now its clear,I had gone through all your solution and it is co.pdfhi,Now its clear,I had gone through all your solution and it is co.pdf
hi,Now its clear,I had gone through all your solution and it is co.pdf
 
falsethey have volume but no shapeSolutionfalsethey have v.pdf
falsethey have volume but no shapeSolutionfalsethey have v.pdffalsethey have volume but no shapeSolutionfalsethey have v.pdf
falsethey have volume but no shapeSolutionfalsethey have v.pdf
 
Conc. H2SO4, heatSolutionConc. H2SO4, heat.pdf
Conc. H2SO4, heatSolutionConc. H2SO4, heat.pdfConc. H2SO4, heatSolutionConc. H2SO4, heat.pdf
Conc. H2SO4, heatSolutionConc. H2SO4, heat.pdf
 
C is correct. The Data Link layer is responsible for encapsulation, .pdf
C is correct. The Data Link layer is responsible for encapsulation, .pdfC is correct. The Data Link layer is responsible for encapsulation, .pdf
C is correct. The Data Link layer is responsible for encapsulation, .pdf
 
AnswerThe hormones and structuresorgansPituitary glandFemal.pdf
AnswerThe hormones and structuresorgansPituitary glandFemal.pdfAnswerThe hormones and structuresorgansPituitary glandFemal.pdf
AnswerThe hormones and structuresorgansPituitary glandFemal.pdf
 

Dernier

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Celine George
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONHumphrey A Beña
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 

Dernier (20)

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17Field Attribute Index Feature in Odoo 17
Field Attribute Index Feature in Odoo 17
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATIONTHEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
THEORIES OF ORGANIZATION-PUBLIC ADMINISTRATION
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 

import java.util.Scanner;public class Calculation {   public sta.pdf

  • 1. import java.util.Scanner; public class Calculation { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); System.out.println("Welcome to the Calcuation Program!"); System.out.println("1. Area of a circle"); System.out.println("2. Volume of a sphere"); System.out.println("3. Volume of a cylindrical solid"); System.out.println("4. Fahrenheit to Celsius conversion"); System.out.print("Select a calculation:"); int choice=sc.nextInt(); if(choice==1){ System.out.print("Enter the radius:"); double rad=sc.nextDouble(); System.out.println(); System.out.printf("The area of the circle with radius %.2f units is %.2f units^2",rad,Math.PI*rad*rad); } else if(choice==2){ System.out.print("Enter the radius:"); double rad=sc.nextDouble(); System.out.println(); System.out.printf("The volume of sphere with radius %.2f units is %.2f units^3",rad,(4*Math.PI*rad*rad*rad)/3); } else if(choice==3){ System.out.print("Enter the radius:"); double rad=sc.nextDouble(); System.out.print("Enter the height:"); double h=sc.nextDouble(); System.out.println(); System.out.printf("The volume of cylindrical solid with radius %.2f units and height %.2f units is %.2f units^3",rad,h,Math.PI*rad*rad*h);
  • 2. } else if(choice==4){ System.out.print("Enter the temperature in Farenheit:"); double temp=sc.nextDouble(); System.out.println(); System.out.printf("The temperature in Celsius is %.2f",59*(temp-32)); } } } Solution import java.util.Scanner; public class Calculation { public static void main(String[] args) { // TODO Auto-generated method stub Scanner sc=new Scanner(System.in); System.out.println("Welcome to the Calcuation Program!"); System.out.println("1. Area of a circle"); System.out.println("2. Volume of a sphere"); System.out.println("3. Volume of a cylindrical solid"); System.out.println("4. Fahrenheit to Celsius conversion"); System.out.print("Select a calculation:"); int choice=sc.nextInt(); if(choice==1){ System.out.print("Enter the radius:"); double rad=sc.nextDouble(); System.out.println(); System.out.printf("The area of the circle with radius %.2f units is %.2f units^2",rad,Math.PI*rad*rad); } else if(choice==2){ System.out.print("Enter the radius:"); double rad=sc.nextDouble();
  • 3. System.out.println(); System.out.printf("The volume of sphere with radius %.2f units is %.2f units^3",rad,(4*Math.PI*rad*rad*rad)/3); } else if(choice==3){ System.out.print("Enter the radius:"); double rad=sc.nextDouble(); System.out.print("Enter the height:"); double h=sc.nextDouble(); System.out.println(); System.out.printf("The volume of cylindrical solid with radius %.2f units and height %.2f units is %.2f units^3",rad,h,Math.PI*rad*rad*h); } else if(choice==4){ System.out.print("Enter the temperature in Farenheit:"); double temp=sc.nextDouble(); System.out.println(); System.out.printf("The temperature in Celsius is %.2f",59*(temp-32)); } } }