SlideShare a Scribd company logo
Here is the code for you:
import java.util.*;
class HeightOfChild
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
double childHeight;
int feet, inches, fatherHeight, motherHeight;
while(true)
{
System.out.print("Enter the gender of child (M)ale or (F)emale: ");
char gender = sc.next().charAt(0);
System.out.print("Choose your input style: 1. Feet & Inches. 2. Inches: ");
int inputStyle = sc.nextInt();
if(inputStyle == 1)
{
System.out.println("Enter the height of the mother: ");
System.out.print("Feet: ");
feet = sc.nextInt();
System.out.print("Inches: ");
inches = sc.nextInt();
motherHeight = feet * 12 + inches;
System.out.println("Enter the height of the father: ");
System.out.print("Feet: ");
feet = sc.nextInt();
System.out.print("Inches: ");
inches = sc.nextInt();
fatherHeight = feet * 12 + inches;
}
else
{
System.out.print("Enter the height of mother in inches: ");
motherHeight = sc.nextInt();
System.out.print("Enter the height of father in inches: ");
fatherHeight = sc.nextInt();
}
if(gender == 'M')
childHeight = ((motherHeight * 13 / 12.0) + fatherHeight) / 2;
else
childHeight = ((fatherHeight * 12 / 13.0) + motherHeight) / 2;
System.out.println("The height of the child is: " + childHeight);
System.out.print("Do you want to calculate again...(Y/N): ");
char again = sc.next().charAt(0);
if(again != 'Y')
return;
}
}
}
If you need any refinements, just get back to me.
Solution
Here is the code for you:
import java.util.*;
class HeightOfChild
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
double childHeight;
int feet, inches, fatherHeight, motherHeight;
while(true)
{
System.out.print("Enter the gender of child (M)ale or (F)emale: ");
char gender = sc.next().charAt(0);
System.out.print("Choose your input style: 1. Feet & Inches. 2. Inches: ");
int inputStyle = sc.nextInt();
if(inputStyle == 1)
{
System.out.println("Enter the height of the mother: ");
System.out.print("Feet: ");
feet = sc.nextInt();
System.out.print("Inches: ");
inches = sc.nextInt();
motherHeight = feet * 12 + inches;
System.out.println("Enter the height of the father: ");
System.out.print("Feet: ");
feet = sc.nextInt();
System.out.print("Inches: ");
inches = sc.nextInt();
fatherHeight = feet * 12 + inches;
}
else
{
System.out.print("Enter the height of mother in inches: ");
motherHeight = sc.nextInt();
System.out.print("Enter the height of father in inches: ");
fatherHeight = sc.nextInt();
}
if(gender == 'M')
childHeight = ((motherHeight * 13 / 12.0) + fatherHeight) / 2;
else
childHeight = ((fatherHeight * 12 / 13.0) + motherHeight) / 2;
System.out.println("The height of the child is: " + childHeight);
System.out.print("Do you want to calculate again...(Y/N): ");
char again = sc.next().charAt(0);
if(again != 'Y')
return;
}
}
}
If you need any refinements, just get back to me.

More Related Content

Similar to Here is the code for youimport java.util.; class HeightOfChild.pdf

Code javascript
Code javascriptCode javascript
Code javascript
Ray Ray
 
Java
JavaJava
Java -lec-5
Java -lec-5Java -lec-5
Java -lec-5
Zubair Khalid
 
In your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdfIn your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdf
arihanthtextiles
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
KimVeeL
 
Java Programs
Java ProgramsJava Programs
Java Programs
Seetharamaiah Vadde
 
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
anjanacottonmills
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
rajeshjangid1865
 
import java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdfimport java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdf
apexelectronices01
 
Write a program (any language) to randomly generate the following se.pdf
Write a program (any language) to randomly generate the following se.pdfWrite a program (any language) to randomly generate the following se.pdf
Write a program (any language) to randomly generate the following se.pdf
archanaemporium
 

Similar to Here is the code for youimport java.util.; class HeightOfChild.pdf (10)

Code javascript
Code javascriptCode javascript
Code javascript
 
Java
JavaJava
Java
 
Java -lec-5
Java -lec-5Java -lec-5
Java -lec-5
 
In your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdfIn your Person classAdd a constant field to store the current yea.pdf
In your Person classAdd a constant field to store the current yea.pdf
 
Lab01.pptx
Lab01.pptxLab01.pptx
Lab01.pptx
 
Java Programs
Java ProgramsJava Programs
Java Programs
 
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
 
Create a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdfCreate a menu-driven program that will accept a collection of non-ne.pdf
Create a menu-driven program that will accept a collection of non-ne.pdf
 
import java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdfimport java.util.Scanner;public class Digits { public static v.pdf
import java.util.Scanner;public class Digits { public static v.pdf
 
Write a program (any language) to randomly generate the following se.pdf
Write a program (any language) to randomly generate the following se.pdfWrite a program (any language) to randomly generate the following se.pdf
Write a program (any language) to randomly generate the following se.pdf
 

More from ANJANEYAINTERIOURGAL

Vasarecta is a series of straight capillaries, that lie parallel to .pdf
Vasarecta is a series of straight capillaries, that lie parallel to .pdfVasarecta is a series of straight capillaries, that lie parallel to .pdf
Vasarecta is a series of straight capillaries, that lie parallel to .pdf
ANJANEYAINTERIOURGAL
 
There is no question posted or image attached to answer hereSolu.pdf
There is no question posted or image attached to answer hereSolu.pdfThere is no question posted or image attached to answer hereSolu.pdf
There is no question posted or image attached to answer hereSolu.pdf
ANJANEYAINTERIOURGAL
 
The technique which is used to exclusively moniter cell death is TRA.pdf
The technique which is used to exclusively moniter cell death is TRA.pdfThe technique which is used to exclusively moniter cell death is TRA.pdf
The technique which is used to exclusively moniter cell death is TRA.pdf
ANJANEYAINTERIOURGAL
 
The DNA polymerase is involved in the complementary DNA strand from .pdf
The DNA polymerase is involved in the complementary DNA strand from .pdfThe DNA polymerase is involved in the complementary DNA strand from .pdf
The DNA polymerase is involved in the complementary DNA strand from .pdf
ANJANEYAINTERIOURGAL
 
The common name of Nymphaea nouchali is blue lotus, star lotus, red .pdf
The common name of Nymphaea nouchali is blue lotus, star lotus, red .pdfThe common name of Nymphaea nouchali is blue lotus, star lotus, red .pdf
The common name of Nymphaea nouchali is blue lotus, star lotus, red .pdf
ANJANEYAINTERIOURGAL
 
story 1what is fiber opticFiber optic refers to the medium and.pdf
story 1what is fiber opticFiber optic refers to the medium and.pdfstory 1what is fiber opticFiber optic refers to the medium and.pdf
story 1what is fiber opticFiber optic refers to the medium and.pdf
ANJANEYAINTERIOURGAL
 
SolutionIt is simple enough to draw the diagram for the beam with.pdf
SolutionIt is simple enough to draw the diagram for the beam with.pdfSolutionIt is simple enough to draw the diagram for the beam with.pdf
SolutionIt is simple enough to draw the diagram for the beam with.pdf
ANJANEYAINTERIOURGAL
 
Rules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdf
Rules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdfRules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdf
Rules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdf
ANJANEYAINTERIOURGAL
 
Radon gas exposure has been a suggestive of lung cancer in many pati.pdf
Radon gas exposure has been a suggestive of lung cancer in many pati.pdfRadon gas exposure has been a suggestive of lung cancer in many pati.pdf
Radon gas exposure has been a suggestive of lung cancer in many pati.pdf
ANJANEYAINTERIOURGAL
 
Provision of Doubtful debts and bad debt expense is an important est.pdf
Provision of Doubtful debts and bad debt expense is an important est.pdfProvision of Doubtful debts and bad debt expense is an important est.pdf
Provision of Doubtful debts and bad debt expense is an important est.pdf
ANJANEYAINTERIOURGAL
 
pH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdf
pH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdfpH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdf
pH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdf
ANJANEYAINTERIOURGAL
 
Molality m = 0.16mFreezing point depression constant of water Kf =.pdf
Molality m = 0.16mFreezing point depression constant of water Kf =.pdfMolality m = 0.16mFreezing point depression constant of water Kf =.pdf
Molality m = 0.16mFreezing point depression constant of water Kf =.pdf
ANJANEYAINTERIOURGAL
 
Malaria is caused by a protozoan called Plasmodium. There are 4 spec.pdf
Malaria is caused by a protozoan called Plasmodium. There are 4 spec.pdfMalaria is caused by a protozoan called Plasmodium. There are 4 spec.pdf
Malaria is caused by a protozoan called Plasmodium. There are 4 spec.pdf
ANJANEYAINTERIOURGAL
 
import java.util.; import orbital.math.; import orbital.algori.pdf
import java.util.; import orbital.math.; import orbital.algori.pdfimport java.util.; import orbital.math.; import orbital.algori.pdf
import java.util.; import orbital.math.; import orbital.algori.pdf
ANJANEYAINTERIOURGAL
 
If the difference of electronegatives (E.N) of the atomsis less then.pdf
If the difference of electronegatives (E.N) of the atomsis less then.pdfIf the difference of electronegatives (E.N) of the atomsis less then.pdf
If the difference of electronegatives (E.N) of the atomsis less then.pdf
ANJANEYAINTERIOURGAL
 
Except first one I.e. their number is fewer than neurons remaining a.pdf
Except first one I.e. their number is fewer than neurons remaining a.pdfExcept first one I.e. their number is fewer than neurons remaining a.pdf
Except first one I.e. their number is fewer than neurons remaining a.pdf
ANJANEYAINTERIOURGAL
 
Elle may sue FDC in Delaware, because FDC has its principal place of.pdf
Elle may sue FDC in Delaware, because FDC has its principal place of.pdfElle may sue FDC in Delaware, because FDC has its principal place of.pdf
Elle may sue FDC in Delaware, because FDC has its principal place of.pdf
ANJANEYAINTERIOURGAL
 
d)HCl because it is ionic and all other are covalentSolutiond).pdf
d)HCl because it is ionic and all other are covalentSolutiond).pdfd)HCl because it is ionic and all other are covalentSolutiond).pdf
d)HCl because it is ionic and all other are covalentSolutiond).pdf
ANJANEYAINTERIOURGAL
 
c. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdf
c. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdfc. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdf
c. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdf
ANJANEYAINTERIOURGAL
 
Bank reconcilation statementAs of October 31, 2015ParticularAmount.pdf
Bank reconcilation statementAs of October 31, 2015ParticularAmount.pdfBank reconcilation statementAs of October 31, 2015ParticularAmount.pdf
Bank reconcilation statementAs of October 31, 2015ParticularAmount.pdf
ANJANEYAINTERIOURGAL
 

More from ANJANEYAINTERIOURGAL (20)

Vasarecta is a series of straight capillaries, that lie parallel to .pdf
Vasarecta is a series of straight capillaries, that lie parallel to .pdfVasarecta is a series of straight capillaries, that lie parallel to .pdf
Vasarecta is a series of straight capillaries, that lie parallel to .pdf
 
There is no question posted or image attached to answer hereSolu.pdf
There is no question posted or image attached to answer hereSolu.pdfThere is no question posted or image attached to answer hereSolu.pdf
There is no question posted or image attached to answer hereSolu.pdf
 
The technique which is used to exclusively moniter cell death is TRA.pdf
The technique which is used to exclusively moniter cell death is TRA.pdfThe technique which is used to exclusively moniter cell death is TRA.pdf
The technique which is used to exclusively moniter cell death is TRA.pdf
 
The DNA polymerase is involved in the complementary DNA strand from .pdf
The DNA polymerase is involved in the complementary DNA strand from .pdfThe DNA polymerase is involved in the complementary DNA strand from .pdf
The DNA polymerase is involved in the complementary DNA strand from .pdf
 
The common name of Nymphaea nouchali is blue lotus, star lotus, red .pdf
The common name of Nymphaea nouchali is blue lotus, star lotus, red .pdfThe common name of Nymphaea nouchali is blue lotus, star lotus, red .pdf
The common name of Nymphaea nouchali is blue lotus, star lotus, red .pdf
 
story 1what is fiber opticFiber optic refers to the medium and.pdf
story 1what is fiber opticFiber optic refers to the medium and.pdfstory 1what is fiber opticFiber optic refers to the medium and.pdf
story 1what is fiber opticFiber optic refers to the medium and.pdf
 
SolutionIt is simple enough to draw the diagram for the beam with.pdf
SolutionIt is simple enough to draw the diagram for the beam with.pdfSolutionIt is simple enough to draw the diagram for the beam with.pdf
SolutionIt is simple enough to draw the diagram for the beam with.pdf
 
Rules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdf
Rules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdfRules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdf
Rules of Solubility can be summarized with CASHn GIA C = Chlorate,.pdf
 
Radon gas exposure has been a suggestive of lung cancer in many pati.pdf
Radon gas exposure has been a suggestive of lung cancer in many pati.pdfRadon gas exposure has been a suggestive of lung cancer in many pati.pdf
Radon gas exposure has been a suggestive of lung cancer in many pati.pdf
 
Provision of Doubtful debts and bad debt expense is an important est.pdf
Provision of Doubtful debts and bad debt expense is an important est.pdfProvision of Doubtful debts and bad debt expense is an important est.pdf
Provision of Doubtful debts and bad debt expense is an important est.pdf
 
pH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdf
pH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdfpH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdf
pH = pKa + log([CO32-][HCO3-]) pH = -log(4.7E-11) + log (0.120.pdf
 
Molality m = 0.16mFreezing point depression constant of water Kf =.pdf
Molality m = 0.16mFreezing point depression constant of water Kf =.pdfMolality m = 0.16mFreezing point depression constant of water Kf =.pdf
Molality m = 0.16mFreezing point depression constant of water Kf =.pdf
 
Malaria is caused by a protozoan called Plasmodium. There are 4 spec.pdf
Malaria is caused by a protozoan called Plasmodium. There are 4 spec.pdfMalaria is caused by a protozoan called Plasmodium. There are 4 spec.pdf
Malaria is caused by a protozoan called Plasmodium. There are 4 spec.pdf
 
import java.util.; import orbital.math.; import orbital.algori.pdf
import java.util.; import orbital.math.; import orbital.algori.pdfimport java.util.; import orbital.math.; import orbital.algori.pdf
import java.util.; import orbital.math.; import orbital.algori.pdf
 
If the difference of electronegatives (E.N) of the atomsis less then.pdf
If the difference of electronegatives (E.N) of the atomsis less then.pdfIf the difference of electronegatives (E.N) of the atomsis less then.pdf
If the difference of electronegatives (E.N) of the atomsis less then.pdf
 
Except first one I.e. their number is fewer than neurons remaining a.pdf
Except first one I.e. their number is fewer than neurons remaining a.pdfExcept first one I.e. their number is fewer than neurons remaining a.pdf
Except first one I.e. their number is fewer than neurons remaining a.pdf
 
Elle may sue FDC in Delaware, because FDC has its principal place of.pdf
Elle may sue FDC in Delaware, because FDC has its principal place of.pdfElle may sue FDC in Delaware, because FDC has its principal place of.pdf
Elle may sue FDC in Delaware, because FDC has its principal place of.pdf
 
d)HCl because it is ionic and all other are covalentSolutiond).pdf
d)HCl because it is ionic and all other are covalentSolutiond).pdfd)HCl because it is ionic and all other are covalentSolutiond).pdf
d)HCl because it is ionic and all other are covalentSolutiond).pdf
 
c. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdf
c. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdfc. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdf
c. 2 methyl 2 pentanolbecause of the aciddic medium the reaction w.pdf
 
Bank reconcilation statementAs of October 31, 2015ParticularAmount.pdf
Bank reconcilation statementAs of October 31, 2015ParticularAmount.pdfBank reconcilation statementAs of October 31, 2015ParticularAmount.pdf
Bank reconcilation statementAs of October 31, 2015ParticularAmount.pdf
 

Recently uploaded

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
TechSoup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
Vivekanand Anglo Vedic Academy
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
CarlosHernanMontoyab2
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
Sandy Millin
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
Levi Shapiro
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Atul Kumar Singh
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup   New Member Orientation and Q&A (May 2024).pdfWelcome to TechSoup   New Member Orientation and Q&A (May 2024).pdf
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdf
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free downloadThe French Revolution Class 9 Study Material pdf free download
The French Revolution Class 9 Study Material pdf free download
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf678020731-Sumas-y-Restas-Para-Colorear.pdf
678020731-Sumas-y-Restas-Para-Colorear.pdf
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...2024.06.01 Introducing a competency framework for languag learning materials ...
2024.06.01 Introducing a competency framework for languag learning materials ...
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
June 3, 2024 Anti-Semitism Letter Sent to MIT President Kornbluth and MIT Cor...
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Guidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th SemesterGuidance_and_Counselling.pdf B.Ed. 4th Semester
Guidance_and_Counselling.pdf B.Ed. 4th Semester
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 

Here is the code for youimport java.util.; class HeightOfChild.pdf

  • 1. Here is the code for you: import java.util.*; class HeightOfChild { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double childHeight; int feet, inches, fatherHeight, motherHeight; while(true) { System.out.print("Enter the gender of child (M)ale or (F)emale: "); char gender = sc.next().charAt(0); System.out.print("Choose your input style: 1. Feet & Inches. 2. Inches: "); int inputStyle = sc.nextInt(); if(inputStyle == 1) { System.out.println("Enter the height of the mother: "); System.out.print("Feet: "); feet = sc.nextInt(); System.out.print("Inches: "); inches = sc.nextInt(); motherHeight = feet * 12 + inches; System.out.println("Enter the height of the father: "); System.out.print("Feet: "); feet = sc.nextInt(); System.out.print("Inches: "); inches = sc.nextInt(); fatherHeight = feet * 12 + inches; } else { System.out.print("Enter the height of mother in inches: "); motherHeight = sc.nextInt(); System.out.print("Enter the height of father in inches: ");
  • 2. fatherHeight = sc.nextInt(); } if(gender == 'M') childHeight = ((motherHeight * 13 / 12.0) + fatherHeight) / 2; else childHeight = ((fatherHeight * 12 / 13.0) + motherHeight) / 2; System.out.println("The height of the child is: " + childHeight); System.out.print("Do you want to calculate again...(Y/N): "); char again = sc.next().charAt(0); if(again != 'Y') return; } } } If you need any refinements, just get back to me. Solution Here is the code for you: import java.util.*; class HeightOfChild { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double childHeight; int feet, inches, fatherHeight, motherHeight; while(true) { System.out.print("Enter the gender of child (M)ale or (F)emale: "); char gender = sc.next().charAt(0); System.out.print("Choose your input style: 1. Feet & Inches. 2. Inches: "); int inputStyle = sc.nextInt(); if(inputStyle == 1) { System.out.println("Enter the height of the mother: ");
  • 3. System.out.print("Feet: "); feet = sc.nextInt(); System.out.print("Inches: "); inches = sc.nextInt(); motherHeight = feet * 12 + inches; System.out.println("Enter the height of the father: "); System.out.print("Feet: "); feet = sc.nextInt(); System.out.print("Inches: "); inches = sc.nextInt(); fatherHeight = feet * 12 + inches; } else { System.out.print("Enter the height of mother in inches: "); motherHeight = sc.nextInt(); System.out.print("Enter the height of father in inches: "); fatherHeight = sc.nextInt(); } if(gender == 'M') childHeight = ((motherHeight * 13 / 12.0) + fatherHeight) / 2; else childHeight = ((fatherHeight * 12 / 13.0) + motherHeight) / 2; System.out.println("The height of the child is: " + childHeight); System.out.print("Do you want to calculate again...(Y/N): "); char again = sc.next().charAt(0); if(again != 'Y') return; } } } If you need any refinements, just get back to me.