SlideShare une entreprise Scribd logo
1  sur  3
(Conversions between feet and meters) Write a class that contains the following two methods:
/** Convert from feet to meters */ public static double footToMeter(double foot) /** Convert
from meters to feet */ public static double meterToFoot(double meter) The formula for the
conversion is: meter = 0.305 * foot foot = 3.279 * meter Write a test program that invokes these
methods to display the following tables:
Feet Meters | 1.0 0.305 | 2.0 0.610 | ... 9.0 2.745 | 10.0 3.050 | Meters Feet 20.0 65.574 25.0
81.967 60.0 196.721 65.0 213.115
Solution
import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.Scanner;
class Programming {
public static void main(String[] args) {
System.out.printf("%-15s%-15s| %-15s%-15s ","Feet","Meters","Meters","Feet");
System.out.println( String.format("%62s"," ").replace(' ', '-') );
for (int m = 20, f = 1 ; f <=10; f++, m+=5) {
System.out.printf("%-15.1f%-15.3f| %-15.1f%-15.3f ",(float)f,
footToMeter(f),(float)m,meterToFoot(m));
}
}
/** Convert from meter to foot */
public static double meterToFoot(double meter) {
return 3.279 * meter;
}
/** Convert from foot to meter */
public static double footToMeter(double foot) {
return 0.305 * foot;
}
}
Output:
Feet Meters | Meters Feet
--------------------------------------------------------------
1.0 0.305 | 20.0 65.580
2.0 0.610 | 25.0 81.975
3.0 0.915 | 30.0 98.370
4.0 1.220 | 35.0 114.765
5.0 1.525 | 40.0 131.160
6.0 1.830 | 45.0 147.555
7.0 2.135 | 50.0 163.950
8.0 2.440 | 55.0 180.345
9.0 2.745 | 60.0 196.740
10.0 3.050 | 65.0 213.135
Conversion between feet and meters

Contenu connexe

Similaire à Conversion between feet and meters

SAS Macros part 3
SAS Macros part 3SAS Macros part 3
SAS Macros part 3venkatam
 
control statements of clangauge (ii unit)
control statements of clangauge (ii unit)control statements of clangauge (ii unit)
control statements of clangauge (ii unit)Prashant Sharma
 
Power of call symput data
Power of call symput dataPower of call symput data
Power of call symput dataYash Sharma
 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0PMILebanonChapter
 
Meters in IBM Maximo Asset Management
Meters in IBM Maximo Asset ManagementMeters in IBM Maximo Asset Management
Meters in IBM Maximo Asset ManagementRobert Zientara
 
Software Verification, Validation and Testing
Software Verification, Validation and TestingSoftware Verification, Validation and Testing
Software Verification, Validation and TestingDr Sukhpal Singh Gill
 
Automated hdl generation of two’s complement wallace multiplier with par
Automated hdl generation of two’s complement wallace multiplier with parAutomated hdl generation of two’s complement wallace multiplier with par
Automated hdl generation of two’s complement wallace multiplier with parIAEME Publication
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)Chhom Karath
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxgilpinleeanna
 
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docxCMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docxclarebernice
 
Unit3 overview of_c_programming
Unit3 overview of_c_programmingUnit3 overview of_c_programming
Unit3 overview of_c_programmingCapuchino HuiNing
 
control statements
control statementscontrol statements
control statementsAzeem Sultan
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfpnaran46
 
Measurements and Units
Measurements and UnitsMeasurements and Units
Measurements and UnitsKen Tominaga
 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for freeBenotCaron
 
Ml2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionMl2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionankit_ppt
 

Similaire à Conversion between feet and meters (20)

Maestro_Abstract
Maestro_AbstractMaestro_Abstract
Maestro_Abstract
 
Java small steps - 2019
Java   small steps - 2019Java   small steps - 2019
Java small steps - 2019
 
Chapter 2
Chapter 2Chapter 2
Chapter 2
 
SAS Macros part 3
SAS Macros part 3SAS Macros part 3
SAS Macros part 3
 
control statements of clangauge (ii unit)
control statements of clangauge (ii unit)control statements of clangauge (ii unit)
control statements of clangauge (ii unit)
 
Power of call symput data
Power of call symput dataPower of call symput data
Power of call symput data
 
Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0Monte Carlo Simulation for project estimates v1.0
Monte Carlo Simulation for project estimates v1.0
 
Meters in IBM Maximo Asset Management
Meters in IBM Maximo Asset ManagementMeters in IBM Maximo Asset Management
Meters in IBM Maximo Asset Management
 
Software Verification, Validation and Testing
Software Verification, Validation and TestingSoftware Verification, Validation and Testing
Software Verification, Validation and Testing
 
Automated hdl generation of two’s complement wallace multiplier with par
Automated hdl generation of two’s complement wallace multiplier with parAutomated hdl generation of two’s complement wallace multiplier with par
Automated hdl generation of two’s complement wallace multiplier with par
 
Chapter i(introduction to java)
Chapter i(introduction to java)Chapter i(introduction to java)
Chapter i(introduction to java)
 
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docxMSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
MSCD650 Final Exam feedback FormMSCD650 Final Exam Grading For.docx
 
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docxCMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
CMIS 102 Hands-On LabWeek 6OverviewThis hands-on lab .docx
 
Unit3 overview of_c_programming
Unit3 overview of_c_programmingUnit3 overview of_c_programming
Unit3 overview of_c_programming
 
BIT211_2.pdf
BIT211_2.pdfBIT211_2.pdf
BIT211_2.pdf
 
control statements
control statementscontrol statements
control statements
 
I need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdfI need help to modify my code according to the instructions- Modify th.pdf
I need help to modify my code according to the instructions- Modify th.pdf
 
Measurements and Units
Measurements and UnitsMeasurements and Units
Measurements and Units
 
How to instantiate any view controller for free
How to instantiate any view controller for freeHow to instantiate any view controller for free
How to instantiate any view controller for free
 
Ml2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regressionMl2 train test-splits_validation_linear_regression
Ml2 train test-splits_validation_linear_regression
 

Plus de dorisc7

(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docx(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docxdorisc7
 
(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docx(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docxdorisc7
 
(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docx(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docxdorisc7
 
(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docx(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docxdorisc7
 
(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
 
-Java programming- Write a class named Junior-java Inherits the Stud.docx
-Java programming-  Write a class named Junior-java  Inherits the Stud.docx-Java programming-  Write a class named Junior-java  Inherits the Stud.docx
-Java programming- Write a class named Junior-java Inherits the Stud.docxdorisc7
 
--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docx--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docxdorisc7
 
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docxdorisc7
 
- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docxdorisc7
 
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docxdorisc7
 
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docxdorisc7
 
(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docxdorisc7
 
(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docxdorisc7
 
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxWhat is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxdorisc7
 
What is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxWhat is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxdorisc7
 
What is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxWhat is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxdorisc7
 
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxWhat is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxdorisc7
 
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxwhat is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxdorisc7
 
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxWhat is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxdorisc7
 
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docxWhat is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docxdorisc7
 

Plus de dorisc7 (20)

(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docx(TCO 2) Which of the following project management activities is associ.docx
(TCO 2) Which of the following project management activities is associ.docx
 
(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docx(TCO 1) Who are the users of managerial accounting information- How do.docx
(TCO 1) Who are the users of managerial accounting information- How do.docx
 
(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docx(Subsequent events) Green- CPA- is auditing the financial statements o.docx
(Subsequent events) Green- CPA- is auditing the financial statements o.docx
 
(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.docx(Reliability engineering) Make a list of six population stereotypical.docx
(Reliability engineering) Make a list of six population stereotypical.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
(JAVA NetBeans) Write a Java program able to perform selection sort-So.docx
 
-Java programming- Write a class named Junior-java Inherits the Stud.docx
-Java programming-  Write a class named Junior-java  Inherits the Stud.docx-Java programming-  Write a class named Junior-java  Inherits the Stud.docx
-Java programming- Write a class named Junior-java Inherits the Stud.docx
 
--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docx--Social Organizations and Core Competencies-- Please respond to the f.docx
--Social Organizations and Core Competencies-- Please respond to the f.docx
 
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
-- I have two classes One is Carnivore and the other is Herbivore- Eac.docx
 
- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx- Answer the following questions about acids 1- What is the phase of a.docx
- Answer the following questions about acids 1- What is the phase of a.docx
 
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx- At time 110 four processes (P1  P4) are waiting for a timeout signal.docx
- At time 110 four processes (P1 P4) are waiting for a timeout signal.docx
 
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
(70 pts) Nuclear History Identify the event in nuclear history that oc.docx
 
(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx(2) The CPU incorporates several major components (as shown in Fig- de.docx
(2) The CPU incorporates several major components (as shown in Fig- de.docx
 
(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx(Audit evidence) The third GAAS of field work requires that the audito.docx
(Audit evidence) The third GAAS of field work requires that the audito.docx
 
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docxWhat is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
What is the Big Bang-SolutionBig Bang is a theory which talks ababo th.docx
 
What is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docxWhat is the concept of sustainable income- Please describe it in your.docx
What is the concept of sustainable income- Please describe it in your.docx
 
What is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docxWhat is the backbone for the Internet- Briefly describe how the Intern.docx
What is the backbone for the Internet- Briefly describe how the Intern.docx
 
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docxWhat is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
What is the pH of a 0-1 M aqueous solution of NaH2PO4SolutionNaH2PO4 -.docx
 
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docxwhat is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
what is the ph of a 0-16M NaF(aq) solution-SolutionNaF(aq) -----------.docx
 
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docxWhat is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
What is the pH of a 0-114 M solution of the acid HA if its ionization (1).docx
 
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docxWhat is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
What is the minimum number of nodes in an AVL tree of height 8- Let N(.docx
 

Dernier

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 

Dernier (20)

Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

Conversion between feet and meters

  • 1. (Conversions between feet and meters) Write a class that contains the following two methods: /** Convert from feet to meters */ public static double footToMeter(double foot) /** Convert from meters to feet */ public static double meterToFoot(double meter) The formula for the conversion is: meter = 0.305 * foot foot = 3.279 * meter Write a test program that invokes these methods to display the following tables: Feet Meters | 1.0 0.305 | 2.0 0.610 | ... 9.0 2.745 | 10.0 3.050 | Meters Feet 20.0 65.574 25.0 81.967 60.0 196.721 65.0 213.115 Solution import java.util.*; import java.lang.*; import java.io.*; import java.util.Scanner; class Programming { public static void main(String[] args) { System.out.printf("%-15s%-15s| %-15s%-15s ","Feet","Meters","Meters","Feet"); System.out.println( String.format("%62s"," ").replace(' ', '-') ); for (int m = 20, f = 1 ; f <=10; f++, m+=5) { System.out.printf("%-15.1f%-15.3f| %-15.1f%-15.3f ",(float)f, footToMeter(f),(float)m,meterToFoot(m)); } }
  • 2. /** Convert from meter to foot */ public static double meterToFoot(double meter) { return 3.279 * meter; } /** Convert from foot to meter */ public static double footToMeter(double foot) { return 0.305 * foot; } } Output: Feet Meters | Meters Feet -------------------------------------------------------------- 1.0 0.305 | 20.0 65.580 2.0 0.610 | 25.0 81.975 3.0 0.915 | 30.0 98.370 4.0 1.220 | 35.0 114.765 5.0 1.525 | 40.0 131.160 6.0 1.830 | 45.0 147.555 7.0 2.135 | 50.0 163.950 8.0 2.440 | 55.0 180.345 9.0 2.745 | 60.0 196.740 10.0 3.050 | 65.0 213.135