Step Description of Task Remark
1 Create a class to represent the student
This class is to define the following data items:
o declare the variables required to store the data of one student (id, name, surname, group)
assign default values to each of these variables
2 Create a number of methods in this class to be able to:
o set the values (set methods) for each of these variables from another class
o return the values of individual variables of this class (get methods) to a calling class
o to enter via keyboard the values for all the variables for a single student e.g.
o setID()
o setName()
o setSurname()
o setGroup()
o getID()
o getName()
o getSurname()
o getGroup()
o enterDetails()
3 Create a main class to declare system variables and control the primary interface to the system
This class has to have a main() method.
4
Declare a data structure e.g. an array of 10 objects of type student
Student studentList[] = new Student[10];
5 In the main class create a process to input the details of 10 students. You can use a loop structure to do the following set of actions for each student:
i) Assign a new instance of the student class to an array element
ii) Call the methods to enter each of the student details (id, name, surname, group) , set the values to the class variables of that array element
repeat statements like :
studentList[n] = new Student();
studentList[n].enterDetails() ;
6 Add a set of statements to allow the user to input an element number and then enter the details of the student and replace the current array element values with the input values. to assign one attribute e.g
System.out.prin tlin(“Enter Name: “);
studentList[n].setName(Keyboa rd.readString() ))
7 Add a set of statements to allow the user to input an element number and then display the details of the student e.g. // to display one attribute
System.out.prin tlin(“Name: “+ studentList[n].getName);
8 In the main class create a process to display the details of the 10 students you can use a loop structure to display the details of each student using the get function for each class variable
for ( ...; ... ; ...) {
....
System.out.prin t(“Name: “+ studentList[n].getName);
...
...
}
9 In the main class add stateme nts to create a menu of options as follows:
a. Enter details of a list of students and store in array
b. Enter details of a single student
c. Display details of a single student
d. Display details of list of students
e. Exit the system
Add a statement to input the user’s choice
// a menu
// display option 1
// display opton 2
// display option 3
..
..
// enter choice
10 Add statements to be able to perform each option depending on the selection.
// input option
switch (option)
case ‘0’:
break;
case ‘1’:
// statements for option 1
break;
case ‘2’:
// statements for option 2
break;
case ’3’:
..
..
}
11 In the main class, create a loop to repeat steps b, c and d (options display, option input , option processing) until the exit option is selected do {
// display
// input
// switch
}
while option != ‘0’ This is how am I programming am I on the right track
I still have a systnex error expected ";" on bold line. please help.This project have a deadline for the 23rd july
public class main_class
{
public static void main (String args []){ Student StudentList a [] = new Student[10];
a.add("Ryan");
a.add("Robert") ;
a.add("Victor") ;
a.add("Jim");
a.add("Sammy");
a.add("Leo");
a.add("Mauro");
a.add("Glen");
a.add("Kyle");
a.add("Kurt");
Iterator i = a.iterator();
while (i.hasNext()) {
System.out.prin tln(i.next());
}
}
}
StudentList[n] = new student();
StudentList[n].enterDetails() ;
System.out.prin tln("Enter id");
StudentList[n].setid(Keyboard .readString()))
System.out.prin tln("Enter Name");
StudentList[n].setName(Keyboa rd.readString() ))
System.out.prin tln("Enter Surname");
StudentList[n].setSurname(Key board.readStrin g()))
System.out.prin tln("Enter Group");
StudentList[n].setGroup(Keybo ard.readString( )))
System.out.prin tln("id:"+Stude ntList[n].getid);
System.out.prin tln("Name:"+Stu dentList[n].getName);
System.out.prin tln("Surname:"+ StudentList[n].getSurname);
System.out.prin tln("Group:"+St udentList[n].getGroup);
for(id;Name;Sur name;Group){
System.out.prin tln("id:"+Stude ntList[n].getid);
System.out.prin tln("Name:"+Stu dentList[n].getName);
System.out.prin tln("Surname:"+ StudentList[n].getSurname);
System.out.prin tln("Group:"+St udentList[n].getGroup);
}
3 1600 JosAH 11,448
Recognized Expert MVP
I still have a systnex error expected ";" on bold line. please help.This project have a deadline for the 23rd july Student StudentList a [] = new Student[10];
You mean this line? Look what you've typed: a is an array of what type? Student
or StudentList? That's what your compiler is whining about; that variable definition
isn't correct; try either this: -
Student[] a= new Student[10];
-
(I think that's the correct one), or try this: -
StudentList[] a= new Student[10];
-
I don't know the type StudentList, so ...
kind regards,
Jos
thanks again for your help it complied on the first part stop again under the brackets saying class interface ,or enum expected.
JosAH 11,448
Recognized Expert MVP
thanks again for your help it complied on the first part stop again under the brackets saying class interface ,or enum expected.
You have to show the relevant part(s) of your source then. It most likely is a
forgotten left or right curly bracket. Check them all (most editors can do that
for you). The compiler expects a class (or an enum since 1.5) at the top level,
i.e. outside of any other class or enum definitions. Reading compiler diagostics
is an accurate little activity.
kind regards,
Jos
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Dave D |
last post by:
What's the Big Java Development Environment These Days? I used to use
VisualCafe years ago....
-- Dave
|
by: Michael Strorm |
last post by:
Hi,
I'm in the middle of "teaching" myself C++. Having skimmed some of
the "Teach Yourself C++ in 21 Days" book, I got a feel for the
language, at least. Then I bought "The C++ Programming Language"
because it was on offer, and I'd have ended up buying it at some stage
anyway.
Skimmed some of that, but there's too much detail (for now) and I
know I won't take it in if I don't get some practice in actually
*writing* programs in C++. I'm...
|
by: Steve Jorgensen |
last post by:
Hi all,
I'm working on a project through a consulting company, and I'm writing some
database code for use in another programmer's project in Excel/VBA. The other
programmer is working through the same consulting company.
I did not initially know this other programmer's experience level, but he
seemed down to earth and friendly. I saw some signs of trouble after having
him try to integrate some of my code, but chalked it up to him...
|
by: Jones |
last post by:
I am having problems with my C# project. The project was built using VS.net
(original release with service pack 1). The project includes windows forms
and a DLL (dot.net)
After getting the application working, everything compiled and was
troubleshooted. Ready for delivery, the owner decided to change the Name of
the application and DLL.
After discussing this with another developer, we decided that the namespace
in the application...
|
by: TJoker .NET [MVP] |
last post by:
Is there any emil alias for sending suggestions for new VB features ?
Here's one. I wish there was a keyword like AbsoluteNamespace.
The reason is recurring on my projects. I usually set the Root Namespace
project property because it simplifies changing it later. My problem happens
when I have to define a type that will not be anywhere under that root
namespace, then I cannot define it in another namespace without removing the
Root...
| |
by: DirtyClamDigger |
last post by:
Hi Everyone: I'm trying to develop a property list to include as
metadata about my object classes. i.e. I want each class I'm developing
to include a PropertyList which will contain ObjectProperty pointers.
ObjectProperty is a class containing the typeid.name() of a type as
it's ObjectType as well as an ObjectName and ObjectDescription.
Basically 3 strings of metadata describing each of a class' member
variables (and hopefully functions)...
|
by: tommaso.gastaldi |
last post by:
I have a solution with 1 project on which I am working on say Pr1
I have another solution with another project, say Pr2.
Source file in the existing Pr2 are organized within several nested
folders.
When I work on the new project Pr1 I would like to have all the source
files of Pr2
( * no DLL !! * ) available within Pr1, without copying them, so that
any change made within Pr1 is also present in Pr2.
|
by: Steven T. Hatton |
last post by:
Perhaps I'm just a bit frustrated, and I will soon realize the clear truth
of the matter, but right now I have some serious misgivings about the value
of investing a lot of time and effort into template programming. I just
finished reading the first 12 chapters of _C++ Templates: The Complete
Guide_. One thing that struck me as I read these chapters is how much I
didn't know about C++. I _know_ the core language specification is...
|
by: AvadhutPhisake |
last post by:
Hi All,
I am having problem after migration project from vc6 to vc8.
Vc6 code works perfectly.
besically project is Automation Exe and i am invoking the Exe from the script.
when i invoke the Exe it is creating instance of exe in memory , but not able to
invoke the function in the Exe.
Other qestion is the (i am using prof Xp ) why i am not able to use CoinitializeEx(thread multithread option)
|
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: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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: 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.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |