Assignment Objectives:
The objective of this assignment is to implement java programs with major object oriented concepts and applet with event handling.
Assignment Purposes
This assignment aims to
Introduce practice problems to students to implement object oriented concepts and GUI programming by using Java programming language.
Makes students to implement specific classes with relevant methods for a specific problem
Test the understanding of java syntax for Applications and Applets
Enhance the academic report writing skills of the student.
Learning Outcomes
On completion of this assignment, students will be able to:
1. Design, implement, test and document Java programs.
2. Implement Java applet with event handling
Tasks
You are required to complete the following questions as per the requirement provided by the questions.
Question 1 : 5 Marks
Write a Java application which meets the following requirements:
1. In the application, you should declare a class called “Employee” with the following details:
Variable Name Description of variable
EmpNo
Employee No
EName
Employee Name
EDesig
EmployeeDesigna tion
BSal
BasicSalary
HRA
HouseRentAllowa nce
Member Functions Description for Member Functions
getValues()
Should initialize the values for the member variables EmpNo, ENname, EDesig, BSal, HRA .
CalculateSalary ()
Should calculate the Gross salary as the sum of the BSal and HRA
DisplayValues()
Should print the value of the instance variables along with Gross salary.
2. In your main method, create N number of Employee objects, where the value of N is obtained from the user and store the objects into an array.
3. Use appropriate methods to read the values of the Employee objects from user, Calculate the Gross Salary for each Employee and print employee details and salary details of all objects created.
4. Use exception handling appropriately.
5. Use comments to illustrate the various concepts applied / utilized in the solution.
6. Ensure the use of meaningful variable names, consistent indentation of program code
Question 2: 5 Marks
Create a JAVA applet program that accepts and displays object’s details on respective GUI components. The Applet consists of seven GUI components such as two labels Name and age followed by two textfields of size 10 respectively. There are two buttons labeled as ADD and DISPLAY followed by a Textarea. The values entered by the user on the text fields are that of two instance variables of a class with name Person and the individual object details are to be stored on an array of type Pesron upon the pressing of ADD button. Users are allowed to add 5 object’s details and while pressing the DISPLAY button, the values of all the five objects are displaying on the Text Area.
Note: Person class should be created with two instance variables and a constructor to initialize the values. Use comments to illustrate the various concepts applied / utilized in the solution.
1 2933
I have an assignment
Good luck with it!
The article on how to start may help.
The assignment itself is very directed and I would suggest working one very small step at a time. At each step make sure your code compiles, runs and does what you expect. If any of these three things fail then you have a question to ask ("what does this compiler message mean?" "why do I get the following runtime error?" "why does the program do this when I expected it to do that?").
If you do decide to ask a question remember to post code so that everyone knows what it is you're asking. Complete and exact compiler and runtime output are very helpful too.
Good luck again!
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Paul Rubin |
last post by:
OK, I want to scan a file for lines matching a certain regexp. I'd
like to use an assignment expression, like
for line in file:
if (g := re.match(pat, line)):
croggle(g.group(1))
Since there are no assignment expressions in Python, I have to use a
temp var. That's a little more messy, but bearable:
|
by: Andrew Koenig |
last post by:
It has been pointed out to me that various C++ books disagree about
the relative precedence of ?: and the assignment operators.
In order to satisfy myself about the matter once and for all,
I looked at the grammar in the C++ standard. The relative fragments
are as follows:
conditional-expression:
logical-or-expression
logical-or-expression ? expression : assignment-expression
|
by: CoolPint |
last post by:
It seems to me that I cannot assign objects of a class which has a constant data
member since the data member cannot be changed once the constructor calls are
completed. Is this the way it is meant to be? Am I not suppose not to have any
constant data member if I am going to have the assignment operator working for
the class?
Or am I missing something here and there is something I need to learn about?
Clear, easy to understand...
|
by: Edward Diener |
last post by:
Is there a way to override the default processing of the assignment operator
for one's own __value types ? I realize I can program my own Assign method,
and provide that for end-users of my class, but I would like to use
internally my own = operator for some of my value types, so I can say "x =
y;" rather than "x.Assign(y);".
The op_Assign operator seems impossibly broken since it takes __value copies
of the two objects. Perhaps there is...
|
by: Rick N. Backer |
last post by:
I have an abstract base class that has char* members. Is an
assignment operator necessary for this abstract base class? Why or
why not?
Thanks in advance.
Ken Wilson
Amer. Dlx. Tele, Gary Moore LP, LP Faded DC,
Jeff Beck Strat, Morgan OM Acoustic,
| |
by: Jon Slaughter |
last post by:
I have a chain of classes(i.e., a series of classes each containing an array
of the next class). Each class has array like access.
struct Myclass1
{
vector(Myclass2) _Myclass2;
Myclass2& operator(int i);
}
|
by: Graham |
last post by:
This has to do with class variables and instances variables.
Given the following:
<code>
class _class:
var = 0
#rest of the class
|
by: Neil Zanella |
last post by:
Hello,
I would like to know whether the following C fragment is legal in
standard C and behaves as intended under conforming implementations...
union foo {
char c;
double d;
};
|
by: nagy |
last post by:
I do the following. First create lists x,y,z. Then add an element to x
using the augumented assignment operator. This causes all the other
lists to be changed also.
But if I use the assignment x=x+ instead of using the augumented
assignment, the y and z lists do not change.
Why is that?
This does not happen when I work with integer data type for example, as
shown below.
Thanks for your help
|
by: TimeHorse |
last post by:
I would like to gauge interest in the following proposal:
Problem:
Assignment statements cannot be used as expressions.
Performing a list of mutually exclusive checks that require data
processing can cause excessive tabification. For example, consider
the following python snipet...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |