Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. Create a package named Qi. Create a driver java class named Taskl which includes the driver method main(). Define a void method (a method

image text in transcribedimage text in transcribed

. Create a package named Qi. Create a driver java class named Taskl which includes the driver method main(). Define a void method (a method that returns nothing) called printHeader, which will accept a value for the lab number and a value for the question number as arguments, when called and returns nothing. The method will print out a row of stars, your full name in the next line, lab information (lab no., and question no.) in the next line and another row of stars in the next line. The method must have the following following header: public static void printHeader(int labNum, int quesNum) . Define a method called printFooter, which will accept a message as argument, when called, prints out that message between three asterisks on either side, and returns nothing. The method must have the following header: public static void printFooter (String anyvalidName) Define a method called cmToInchConverter, which, when called, will accept a length value in centimeters (cm) scale as an argument and return the value in inch scale by using the expression: 1 inch = 2.54 cm. The method must have the following header: public static double cmToInchConverter (double cm) Write the driver method which calls printHeader(), cmToInchConverter() and printFooter() methods to reproduce an output similar to the one below. Declare a variable holding the value of 3.3 centimeters and pass it as an argument to the cm ToInchConverter() method. Display the return value in inches. Note: The methods must be called from within the driver method. No user input is required for this question. Follow the formatting and structure of the sample output. 6.3 Question 1 (8 marks) Create a package named Q3. Create a driver java class named Task3 which will include the four public static methods: printHeader(), printFooter(), celsiusToFahrenheit() and the driver, Define the Header and footer methods (copy-paste from Question 1) Define a public static method celsiusToFahrenheit() with appropriate formal parameter list and return type, which will accept a temperature value in Celsius (C) scale as an argument when called and return the value in Fahrenheit (F) scale by using the expression: C/5 = (F-32)/9 Complete the driver method with the following specs in sequence as outlined below: Print the custom header message with the appropriate question number as argument by calling the header method. o Prompt the user to input a temperature in Celsius, using Scanner reference variable. Call the celsiusToFahrenheit() and pass the Celsius value as argument list and then print the returned Fahrenheit value with two decimal places from the driver method using printf() statement. o Print the custom footer message by calling the footer method

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions