Question: LAB01: Java Programming, Java data types and user defined methods & Classes. Time to Complete: Approx 3 hours Learning Outcomes Covered: 1, 2, 5, 6

LAB01: Java Programming, Java data types and user defined methods & Classes. Time to Complete: Approx 3 hours Learning Outcomes Covered: 1, 2, 5, 6 Brief Description: In this LAB students will: 1. Create a simple java console applications from a set of requirements that accept input from the keyboard and display output to the screen. 2. Modify the above application to incorporate a JOptionPane to collect and display information. 3. Accept input data using the JOptionPane class, then then takes this data and converts it to integer and double values for arithmetic manipulation. 4. Incorporate user defined methods. Includes methods that are passed no parameters and return no data, are passed parameters and return no data, are passed parameters and return data.

Overview of requirements:

Write a Java program that produces quotes for blinds that a prospective customer wishes to order. The quote includes a fixed cost of $85 per blind, this is for parts that come with all blinds ( eg. Springs, brackets, etc.) and a variable cost of: $25.50 per square metre of blind material.

The system should prompt the user to enter their name, MOB, email, the dimensions of the blind, its width and length, the number to be purchased, and then calculates the cost of the blinds.

Let us provide a console user interface first, and extend it to graphical user interface (GUI) at a later stage. The console interface should accept input from the keyboard and generate textual output to the console.

The formula for calculating the blind is: TotalCost = (85.0 + 25.50 X ( width X length) ) * number_of_blinds;

The steps ( Algorithm) needed are:

// Get User details Prompt the user to enter their name.

Get their name and store it in a variable.

Prompt the user to enter their MOB.

Get their MOB and store it in a variable.

Prompt the user to enter their email.

Get their email and store it in a variable.

// get Blind details

Prompt the user to enter the width of the blinds.

Get the width and store it in a variable.

Prompt the user to enter the length of the blinds.

Get the length and store it in a variable.

Prompt the user to enter the number of blinds.

Get the number and store it in a variable.

Calculate the Total cost. Display the User details and the Total cost.

PART A

Create a Console application that implements the above algorithm.

PART B

Create an application that implements the above algorithm and uses the JOptionPane GUI to collect the information and display the information.

(NOTE: This does not make the program a TRUE GUI program.) Modify the program so that it includes these extra features. $2.50 per meter for a scallop bottom fringe. $1.50 per metre to sew an over-lock around the blind.

PART C

Create an application that implements the above algorithm and uses the JOptionPane GUI to collect the information and display the information, but also incorporates user defined methods. These methods should be called from the main method.

String getName() : Prompts for and collects the customers name and returns it to the main method.

String getMOB() : Prompts for and collects the customers MOB and returns it to the main method.

String getEmail() : Prompts for and collects the customers email and returns it to the main method.

double getLength() : Prompts for and collects the Length of the blind and returns it to the main method.

int getnumber() : Prompts for and collects the Number of blinds purchased and returns it to the main method.

double calculateTotalCost(double,double, int) : Is passed the width of the blind, the length of the blind, and the number of blinds required and calculates the total cost and returns this figure to the main method.

void displayDetails(string,string, string, double, double, int) : Is passed all the details and displays the information.

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!