Solution:
Java language high level language. A language is known as high level language if it provides human readable syntaxes for programming where as low level languages provides machine instructions which are not user friendly. Java uses English language for programming commands.
Basic characteristics of Java Language:
Advantages and Disadvantages of JDK system with an IDE like Netbeans:
Advantages of using an IDE:
Solution:
Platform Independence
Java language is platform independent. First of all its source code gets compiled into a class file which is also known as Byte Code. Byte code contains machine instructions for the operating system. This generated byte code is same for all platforms id Windows, Linux, Mac etc. Byte code is evaluated and interpreted by Java Virtual Machine (JVM). JVM is platform dependent but it is available for all platforms.
Thus byte code instructions and JVM together makes Java platform independent.
Java for Mobile Applications (Java ME)
Java ME stands for Java Micro Edition. It enables us to develop applications for small devices like pages, set-top boxes, mobile phones etc. Java ME is specifically designed for battery operated devices with small memory and processing speed. Java ME provides a special JVM for micro devices which is known as KVM. It is a cut down version of standard JVM and optimized for working in very small amount of memory (256 KB)
Embedded Hardware Programming in Java
Java provides an extension of Micro Edition API which is suitable for embedded applications and known as Java ME Embedded. It enables users to develop highly secure, robust, scalable and functional applications for embedded devices like cameras, flight control systems and ATM machines.
Solution
My java programming solution is as follows:
Possible Inputs:
width of room: It is required to calculate area of the room.
Length of room: It is required to calculate area of the room.
Possible Outputs:
Area: The application will display final area on which all work has to be done.
Time: The application will display total time required to complete the work.
Cost: The application will display final cost for the work.
Possible User Interface:
Solution:
Variable Names used in the application
Variable Name |
Data-Type |
Java Statement |
roomLength |
double |
private double roomLength = 0.0; |
roomBreadth |
double |
private double roomBreadth = 0.0; |
roomArea |
double |
private double roomArea = 0.0; |
estimatedTime |
int |
private intestimatedTime = 0; |
cost |
double |
private double cost = 0.0; |
robertsWage |
double |
private double robertsWage = 0.0; |
woodCost |
double |
private double woodCost = 0.0; |
Constants used in the application
Constant Name |
Data-Type |
Java Statement |
avgRateOfInstallation |
byte |
private final byte avgRateOfInstallation = 3; |
assistantPrice |
float |
private final float assistantPrice = 10.25f; |
priceOfWood |
float |
private final float priceOfWood = 19.95f; |
robertCharge |
float |
private final float robertsCharge = 85.0f; |
Pseudo Code: Pseudo code is step by step instruction set to solve a problem. It specify basic logic which is to be implemented in order to solve a problem. Functionality of this application “Wage Calculator” can be achieved by following these steps:
Flowchart
Solution:
Java Programming Solution
Following is screen shots of java code in net beans editor:
Solution:
Solution:
Following behaviors are defined to calculate wages for the application.
Solution:
Following screens shows error and exception handling in the application
Solution:
All screens of the application are designed in Netbeans IDE using Swing editor. Application interface is as follows.
Figure: Initial screen to read number of rooms.
Figure: Screen to read room details from user.
Figure: Screen after filling the data.
Figure: Confirmation message before moving to next screen.
Figure: Error Message if user leaves blank fields and tries to move to next screen.
Figure: Confirmation before final submission
Figure: Final result with debit card option.
Figure: Final result with credit card option.
Solution:
This application “Wage Calculator” is critically reviewed and tested and results are as follows:
Solution:
Test results against expected test results are as follows:
Test Case |
Expected Result |
Actual Results |
Input Checking and Validation |
Application must display error message for invalid input. |
Application is displaying error message for every wrong input. |
Floating Point Calculation |
While calculating cost and area application must perform strict float point calculations for precise results. |
Application is performing strict floating point calculation and displaying floating point values preciously. |
Wage Calculation / Final output |
Application must calculate wages and display output by following guidelines as specified in the assignment. |
Application is displaying all outputs, and outputs pass all criteria as specified in assignment. |
Solution:
At evaluation time this application was working fine but all error messages of the application were displaying on the console. So I got a recommendation for displaying messages in a dialog box.
Now we have applied this recommendation by using JOptionPane to display message dialogs.
Solution:
This application helps to calculate total wage of wood flooring. It can be used to calculate room area, flooring cost and extra charges for credit or debit card payment.
User can use the application by following these steps:
Solution:
The functionality of the application given in the assignment is defined in class “WageCalculator”. This class keeps details about the work which has to be done (Flooring on rooms) like room’s length and breadth, work cost, time etc. and provides methods to calculate final amount of the work.
It provides following methods:
Java API documentation for Wage Calculator.
Java API Documentation for wage calculator
Details
Other Assignments
Related Solution
Other Solution