Question: Create a package named Q 1 . Create a class called MyMethods which will include the driver method main ( ) . Define a public

Create a package named Q1.
Create a class called MyMethods which will include the driver method main().
Define a public static void method called myHeader(), which will accept a value for the lab
number, a value for the question number as a short description about the program, as
arguments and use those values inside the method when printing your header information
as shown in the sample output. The method must have the following header, where you
need to pick up the appropriate dataType that you think necessary:
public static void myHeader(dataType labNum, dataType questionNum, datatype
description);
ES1036B - Programming Fundamentals for Engineers Lab Exercise 03
Page 5 of 7
Define a public static void method called myFooter(), which will accept the question
number as an argument, when called, and use that argument while printing out a message
along with between three asterisks on either side, as shown in the sample output. The
method must have the following header:
public static void myFooter(dataType questionNumber);
Define a public static value-returning method called inchesToCentimetres(), which, when
called, will accept a height of a person in inches scale as an argument and return the value
in centimetres (cm) scale by using the expression: 1 inch =2.54 cm. The method must have
the following header (It is your responsibility to pick up the correct dataType):
public static dataType inchesToCentimetres(dataType inches);
Define the driver method (main() method) with the following specifications:
o Call your myHeader() method with appropriate arguments.
o Prompt the user to enter a height value in inches. Assume that the user will enter a
valid value.
o Call the inchesToCentimetres() method and display the return value in cm using
printf() method with up to two decimal places.
o Also, the result should be displayed in metres and cm as shown. In this case, the
metre unit should be displayed as integer value while the leftover cm should be
displayed as real number using two decimal places. Hint: you may have to use the
concept of casting, integer division and modulus operations (Unit 2.5).
o Call myFooter() method with appropriate argument.
****************************************************
Full Name: .......
Lab Exercise: 3, Question: 1
Program Description: ..........
*****************************************************
Enter your height in inches: 71.85
71.85 inches =182.50 cm
182.50 cm =1 m 82.50 cm
*** Signing off from Question 1 yourFirstName ***

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!