If the user must input values, how can I enable the user to edit these values. Can u pls give me an example.What is the code for retrieving the data to edit it, and then update this data ?
thanks in advance
Printable View
If the user must input values, how can I enable the user to edit these values. Can u pls give me an example.What is the code for retrieving the data to edit it, and then update this data ?
thanks in advance
You mean something like the following:
- user inputs data
- print to screen what user input
- ask again if user want's to change his input
Luck,
CJSL
thanks for the help but I don't really understand how to do that.I made this code for the user to input data:
class editstudentdetails
{
public static void main(String[] args){
int N;
String[] studName;
if (int N=0;N<studName.length;N++){
System.out.print("Enter name for student number" +N+ ":" );
studName[N]=keyboard.nextInt();
System.out.print("Enter form /1-5/ for student " +N+ "." +studName+ ":" );
studForm[N]=keyboard.nextInt();
System.out.print("Enter group /A-D/ for student " +N+ "." +studName+ ":");
studGroup[N]=keyboard.nextChar();
System.out.print("Enter mark of maths for student" +N+ "." +studName+ ":");
studMarkMths[N]=keyboard.nextInt();
System.out.print("Enter mark of physics for student" +N+ "." +studName+ ":");
studMarkPhys[N]=keyboard.nextInt();
System.out.println("Enter mark of computing for student" +N+ "." +studName+ ":");
studMarkComp[N]=keyboard.nextInt();
This is what I did so far but it's a total mess. Is this the way to display the details for each student of from 1-5 consecutively? I don't know how to make it right. I'm confused
public class viewDetails(String[] studName, int[] studForm, char[] studGroup, int[] studMarkMths, int[] studMarkPhys, int[] studMarkComp)
{
public String getstudName()
{
return studName;
}
public Double getstudForm()
{
return studForm;
}
public Char getstudGroup()
{
return studGroup;
}
public Double getstudMarks()
{
return studMarkMths;
return studMarkPhys;
return studMarkComp;
int f;
for (f=0,f<=form.length, f++){
System.out.print("Name:"+studName[f]);
System.out.print("Form:"+studForm[f]);
System.out.print("Group:"+studGroup[f]);
System.out.print("Maths:"+studMarkMths[f]);
System.out.print("Physics:"+studMarkPhys[f]);
System.out.print("Computing:"+studMarkComp[f]);
System.out.print("");
System.out.print("");
}
I'm thinking two things right now:
1) You don't know what you need to do.... at least I'm confused about it. So why not sit down, take a big breath and write down exactly what you need your program to do. Then, when you understand that, write down the steps that need to happen to get that task done. Then when that is done you can start to commit grey matter to code.
2) You don't have the Java basics to go forward. I would suggest studing the following tutorial:
The Java™ Tutorials
Another good link is the Java 6 API Specification,, which tells the specifics about the Java classes and their methods:
Java Platform SE 6
Luck,
CJSL