Unit 41 Programming in Java Assignment Sample

Home
breadCrumb image
Solution
breadCrumb image
Unit 41 Programming in Java Assignment Sample
programming in Java Assignment Sample
Unit 41 Programming in Java Assignment Sample

LO1: Understand the principles of programming in Java

1.1 Discuss the principles, characteristics and features of programming in java

 

Solution:

Java language high-level language. A language is known as a high-level language if it provides human-readable syntaxes for programming whereas low-level languages provide machine instructions which are not user-friendly. Java uses the English language for programming commands.

 

Basic characteristics of Java Language:

1. Object Oriented Programming: If our problem is solved in terms of classes and objects then it is known as Object Oriented Programming. In object-oriented programming, every problem is solved in terms of classes and objects. Features of object-oriented programming:

(i) Encapsulation: Encapsulation means packaging all class data and code into a class which prevents it from outside access and misuse.

(ii) Inheritance: If a class is derived from another class then it is known as Inheritance. Using inheritance we can extend features of a class.

(iii) Polymorphism: Polymorphism means one name in many forms. Using polymorphism we can define different functionality for a class inheritance hierarchy with the same name.


2. Distributed: Java provides distributed applications functionality which enables us to run different parts of an application on different machines. Java RMI (Remote method invocation) and EJB (Enterprise Java Beans) enable us to create distributed applications.

3. Robust: Robust means strong. Java provides strong memory server management. Java doesn’t provide pointers to avoid security problems. It also provides automatic garbage collection and robust error & type checking.

Locus Assignments specialises in assisting students with their programming coursework and assignments, including detailed guidance on Java’s object-oriented principles and robust error handling. Assignment helpers can offer personalised solutions for understanding these complex concepts.

 

Advantages and Disadvantages of JDK system with an IDE like Netbeans:

Advantages of using an IDE:
 

1. IDEs provide syntax highlighting to users.

2. IDEs provide automatic indentation for code blocks.

3. IDEs provide line numbers to their users.

4. 
IDEs provide auto-code completion.

5. 
IDEs provide auto-code generation for inherited members.

6. 
IDEs provide code debugging functionality and make checkpoints to find out errors.

7. 
Some IDEs provide GUI builders to build applications for rapid application development.
Disadvantages of using an IDE:

8. 
IDEs prevent novice programmers from having basic knowledge of the language.

9. 
IDEs generate generalised code which is not optimised for all applications.

10. 
IDEs show compatibility issues with projects of other IDEs.
 

However, some downsides include that IDEs can sometimes over-simplify programming processes, which may prevent novice developers from gaining foundational coding skills. For comprehensive support, we offer a coding assignment help service to assist students with practical exercises and troubleshooting on platforms like NetBeans.

 

1.2 critically evaluate the environmental flexibility of programming in Java


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 the same for all platforms 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 make the 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 optimised for working in a 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.

 

LO2: Be able to design Java Solutions


2.1 Design a Java programming solution for a given problem.


Solution

My Java programming solution is as follows:

Possible Inputs:

Width of room: It is required to calculate the area of the room.

Length of room: It is required to calculate the area of the room.

Possible Outputs:

Area: The application will display the final area on which all work has to be done.

Time: The application will display the total time required to complete the work.

Cost: The application will display the final cost for the work.

 

Possible User Interface:
 

Unit 41 Programming in Java Assignment Sample 


Locus Assignments, with expert assignment helpers, can help you with assignment designs by providing practical and well-structured guidance. They cover solution formulation, variable assignment, and the creation of a user interface.


2.2 Explain the components and data file structure required to implement a given design.


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 instructions set to solve a problem. It specifies the basic logic which is to be implemented to solve a problem. The functionality of this application “Wage Calculator” can be achieved by following these steps:

1. Application Start: The user starts the application.

2. Read the number of rooms in which the process has to be applied.

3. Read the length of the room and breadth of the room from the user.

4. Calculate the area of the room by multiplying room length and breadth ( (area = length*breadth).

5. Repeat Step 3 until the area of all rooms has been calculated.

6. Calculate the total area of all rooms by adding individual room areas.

7. Calculate the time required for installation (in hours), using the area of the room and rate of installation (3m2/hour).

8. Calculate the cost of assistants by multiplying total time and salary (€10.25/hour).

9. Calculate Robert’s Wage by multiplying the total time and Robert’s charges (.€85.00/week).

10. Calculate the cost of wood by multiplying the area and price of wood (€19.95/m2)

11. Finally, calculate total wage = (assistants cost) + (Roberts charges) + (cost of wood).

12. If the wage is>€300 then payment mode can be debit and credit only

13. If payment mode is debit then final wage = wage +€0.50.

14. If the payment mode is credit then final wage = wage + 2% of the wage.

15. Otherwise final wage = wage.

16. End of program.


Flowchart
 

Unit 41 Programming in Java Assignment Sample 

Need help?

Get Complete Solution From Best Locus Assignment Experts.

Place an order


LO3: Be able to implement Java Solutions


3.1 Implement a java programming solution based on a prepared design.


Solution:

Java Programming Solution


Following is screen shots of java code in net beans editor:
 

Unit 41 programming in Java Assignment Sample

Unit 41 Programming in Java Assignment sample

Unit 41 Programming in Java Assignment Sample


3.2 Define relationships between objects to implement design requirements


Solution:
 

Unit 41 Programming in Java Assignment Sample


3.3 Implement object behaviors using control structures to meet the design algorithms

Solution:


Following behaviors are defined to calculate wages for the application.
 

Unit 41 Programming in Java Assignment Sample


3.4 Identify and implement opportunities for error handling and reporting

Solution:


Following screens shows error and exception handling in the application
 

1. Error Handling for empty string
 

Unit 41 programming in Java Assignment Sample


2. Error Handling for invalid value

Unit 41 Programming in Java Assignment Sample


3.5 Make effective use of an Integrated web Development Environment (IDE) including code and screen templates.
 

Solution:

All screens of the application are designed in Netbeans IDE using Swing editor. Application interface is as follows.

 

Unit 41 programming in Java Assignment sample

Figure: Initial screen to read number of rooms.
 

Unit 41 programming in Java Assignment Sample


Figure: Screen to read room details from user.
 

Unit 41 Programming in Java Assignment Sample


Figure: Screen after filling the data.
 

Unit 41 Programming in Java Assignment Sample


Figure: Confirmation message before moving to next screen.
 

Unit 41 Programming in Java Assignment Sample


Figure: Error Message if user leaves blank fields and tries to move to next screen.
 

Unit 41 Programming in Java Assignment Sample


Figure: Confirmation before final submission
 

Unit 41 programming in Java Assignment Sample


Figure: Final result with debit card option.
 

Unit 41 programming in Assignment Sample


Figure: Final result with credit card option.

Locus Assignments can guide you in Java code implementation, helping with aspects like object relationships, behaviour definitions, and control structures to achieve expected results. Additionally, their assignment help service can address questions about effective IDE usage and interface design.

 

LO4. Be able to test and document java solutions
 

4.1 Critically review and test a java programming solution

Solution:
 

This application “Wage Calculator” been critically reviewed and tested and the results are as follows:

1. Review for User Interface: User Interface of this application is very simple and friendly. All input fields have proper labels.

2. Review for error handling: This application properly handles all input errors and shows appropriate messages to its users.

 

4.2 Analyse actual test results against expected test results to identify discrepancies.

Solution:

Test results against expected test results are as follows:
 

Test Case

Expected Result

Actual Results

Input Checking and Validation

The application must display an error message for invalid input.

The application is displaying an error message for every wrong input.

Floating Point Calculation

While calculating cost and area application must perform strict float point calculations for precise results.

The application performs strict floating point calculation and displays floating point values preciously.

Wage Calculation / Final output

The application must calculate wages and display output by following guidelines as specified in the assignment.

The application displays all outputs, and outputs pass all criteria as specified in the assignment.


4.3 Evaluate independent feedback on a developed Java Program solution and make recommendations for improvements.

 
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.

 

4.4 Create user documentation for developed Java program solution.

Solution:


This application helps to calculate the total wage of wood flooring. It can be used to calculate room area, flooring cost and extra charges for credit or debit card payments.

Users can use the application by following these steps:

1. Start the application

2. Specify the number of rooms in which the customer wants to apply wood flooring.

3. Enter details about the “Length” and “Breadth” of each room.

4. Now press enter on the “Breadth” field.

5. The application will automatically display “Area of Room”, “Estimated Time” and “Total Cost” for each room.

6. Click on the “Next Room” button.

7. Now repeat from step 3 until details of all rooms are entered.

8. After specifying details about all the rooms, click on the “View Total Amount” Button.

9. On the Next screen application displays the total rooms on which flooring is applied, the Total estimated time for work, the total cost and options for payment with a debit or credit card.

 

4.5 Create technical documentation for support and maintenance of a Java program solution.


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 the room’s length and breadth, work cost, time etc. and provides methods to calculate the the final amount of the work.
It provides the following methods:

 

1. Calorie (): It is used to calculate the area of a room.

2. calTime(): It is used to calculate the total time required for wood flooring in a given area.

3. calAssistantsWage(): It is used to calculate the total wage for Robert’s assistant for a specific time at a given rate.

4. calRobertsWage(): Since Robert also charges for his service this function is used to calculate Robert’s wage for a specific time.

5. calPriceOfWood(): It is used to calculate the total price of the wood for work.

6. calTotalCost(): It is used to calculate the total cost of the work which has been done.


Java API documentation for Wage Calculator.

Locus Assignments offers robust testing frameworks to verify that your solution meets design specifications. Their assignment help service can guide you through documenting Java solutions, providing clear user instructions and comprehensive technical documentation for ongoing maintenance.

Need help with assignment coding or troubleshooting? Connect with Locus Assignments for detailed support across programming languages, including Java.

 

References:

  • Java The Complete Reference (English) 8th Edition by Herb Schildt
  • Java Black Book by Steven Holzner
  • Flow Charts [Online] [Accessed on 23 November 2014]. Available on world wide web: <http://en.wikipedia.org/wiki/Flowchart>
  • UML [Online]. [Accessed on 24 November 2014]. Available on world wide web <http://www.tutorialspoint.com/uml/>
FAQ's