Jump to content

JamesBong

Members
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About JamesBong

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. JamesBong

    Ajutor program java

    Problema rezolvata. Iti multumesc.
  2. JamesBong

    Ajutor program java

    Salut. Va multumesc pentru sfaturi....foarte constructive ..... Am facut un alt program prin care sa invat despre arrayList si cand dau enroll student cumva sare peste firstName si inregistreaza doar surname. Am tot incercat sa ii dau de cap si nu reusesc. import java.util.Scanner; import java.util.ArrayList; public class arrayList { static Scanner input = new Scanner(System.in); static ArrayList<String> firstName = new ArrayList<String>(); static ArrayList<String> surname = new ArrayList<String>(); public static void main(String[] args) { menu(); } public static void menu() { byte choice; System.out.println("Main menu"); System.out.println("*********"); System.out.println("1. Enroll student"); System.out.println("2. List students"); System.out.println("Make a choice: "); choice = input.nextByte(); switch(choice) { case 1: enroll(); System.out.println("You have successfully added a student."); System.out.println(); menu(); break; case 2: list(); menu(); break; default: System.out.println("Please make a valid choice."); System.out.println(); menu(); break; } } public static void list() { int n = 1; for(int x = 0; x < firstName.size();x++) { System.out.println(n + ". " + firstName.get(x) + " " + surname.get(x)); n++; } } public static void enroll() { String fn, sn; System.out.println("Please enter the first name:"); fn = input.nextLine(); System.out.println("Please enter the surname:"); sn = input.nextLine(); firstName.add(fn); surname.add(sn); } }
  3. JamesBong

    Ajutor program java

    Am facut cateva modificari la cod si acum primesc urmatoarea eroare dupa ce bag datele la enroll student si nu imi dau seama cum o pot rezolva. public class Student { private String[] firstname; private String[] surname; private String[] course; private String[] adress; private String[] tel; private String[] email; private String[] dob; private String[] country; private int[] fees; private int[] id; private int n = 0; private int idn = 10000; int studentCount = 0; public Student(String fn, String sn, String crse, String adr, String tel_, String mail, String db, String ctry) { firstname[n] = fn; surname[n] = sn; course[n] = crse; adress[n] = adr; tel[n] = tel_; email[n] = mail; dob[n] = db; country[n] = ctry; id[n] = idn + 1; fees[n] = 9000; studentCount++; idn++; n++; } public void listStudent() { for(int x = 0; x < studentCount; x++) { System.out.printf("%s %s %s %s %s %s %s %s %d %d%n ", firstname[n], surname[n], course[n], adress[n], tel[n], email[n], dob[n], country[n], id[n], fees[n] ); } } } import java.util.Scanner; public class StudentTest { static Scanner input = new Scanner(System.in); public static void main(String[] args) { menu(); } public static void menu() { byte choice; System.out.println("*************************"); System.out.println("* Bright Future College *"); System.out.println("*************************"); System.out.println("1. Enroll student"); System.out.println("2. Pay fees"); System.out.println("3. List students on a course"); System.out.println("4. Change course"); System.out.println("5. View student profile"); System.out.println("6. Remove student from course"); System.out.println("7. ****Management reporting****"); System.out.println("8. Exit"); choice = input.nextByte(); input.nextLine(); switch(choice) { case 1: enroll(); menu(); break; case 3: //Student.listStudent(); default: System.out.println("Please enter a valid option!"); menu(); } } public static void enroll() { System.out.println("Please enter the first name: "); String fn = input.nextLine(); System.out.println("Please enter the surname: "); String sn = input.nextLine(); System.out.println("Please enter the course: "); String crse = input.nextLine(); System.out.println("Please enter the full adress: "); String adr = input.nextLine(); System.out.println("Please enter the telephone number: "); String tel_ = input.nextLine(); System.out.println("Please enter the email: "); String mail = input.nextLine(); System.out.println("Please enter the date of birth: "); String db = input.nextLine(); System.out.println("Please enter the type of student(home or foreign "); String ctry = input.nextLine(); Student student = new Student(fn, sn, crse, adr, tel_, mail, db, ctry); } } Un sfat va rog.
  4. JamesBong

    Ajutor program java

    Sunt la facultate in UK si la facultatea la care sunt eu se incepe pe 15 iunie, chiar daca majoritatea facultatilor de aici incep in septembrie.....nu stiu de ce
  5. JamesBong

    Ajutor program java

    Va multumesc tuturor pentru raspunsuri....O sa citesc din nou despre metode si clase si un crash course despre java.
  6. JamesBong

    Ajutor program java

    Sunt la inceput in saptamana 4 si trebuie sa fac asta in 3 saptamani si prea nu stiu cum....profesorul ne citeste materialul de curs si nu ne da exemple sa intelegem principiile.
  7. JamesBong

    Ajutor program java

    Salut Am de facut pentru facultate un program in Java si anume sistem pentru inregistrarea studentilor unei facultati. Nu vreau sa scrie cineva programul pentru mine, am nevoie de ghidare, daca sunteti amabili. Si iata ce am facut eu pana acum : public class Student { private static String[] firstname; private static String[] surname; private static String[] course; private static String[] adress; private static String[] tel; private static String[] email; private static String[] dob; private static String[] country; private static int[] fees, id; private static int n = 0; private static int idn = 10000; private static int studentCount = 0; public static void addStudent(String fn, String sn, String crse, String adr, String tel_, String mail, String db, String ctry) { firstname[n] = fn; surname[n] = sn; course[n] = crse; adress[n] = adr; tel[n] = tel_; email[n] = mail; dob[n] = db; country[n] = ctry; id[n] = idn + 1; fees[n] = 9000; studentCount++; idn++; n++; } public static void listStudent() { for(n = 0; n < studentCount; n++) { System.out.printf("%s %s %s %s %s %s %s %s %d %d%n ", firstname[n], surname[n], course[n], adress[n], tel[n], email[n], dob[n], country[n], id[n], fees[n] ); } } } import java.util.Scanner; public class StudentTest { static Scanner input = new Scanner(System.in); public static void main(String[] args) { menu(); } public static void menu() { byte choice; System.out.println("*************************"); System.out.println("* Bright Future College *"); System.out.println("*************************"); System.out.println("1. Enroll student"); System.out.println("2. Pay fees"); System.out.println("3. List students on a course"); System.out.println("4. Change course"); System.out.println("5. View student profile"); System.out.println("6. Remove student from course"); System.out.println("7. ****Management reporting****"); System.out.println("8. Exit"); choice = input.nextByte(); input.nextLine(); switch(choice) { case 1: enroll(); menu(); break; case 3: Student.listStudent(); default: System.out.println("Please enter a valid option!"); menu(); } } public static void enroll() { System.out.println("Please enter the first name: "); String fn = input.nextLine(); System.out.println("Please enter the surname: "); String sn = input.nextLine(); System.out.println("Please enter the course: "); String crse = input.nextLine(); System.out.println("Please enter the full adress: "); String adr = input.nextLine(); System.out.println("Please enter the telephone number: "); String tel_ = input.nextLine(); System.out.println("Please enter the email: "); String mail = input.nextLine(); System.out.println("Please enter the date of birth: "); String db = input.nextLine(); System.out.println("Please enter the type of student(home or foreign "); String ctry = input.nextLine(); Student.addStudent( fn, sn, crse, adr, tel_, mail, db, ctry); } } Asta am facut pentru inceput. Nu stiu exact cum sa inregistrez studenti noi, sau cum sa chem metoda din alta clasa sa inregistrez studenti. Orice sfat ar fi foarte apreciat.
  8. JamesBong

    Ajutor Program Visual Basic

    mersi pt ajutor, am rezolvat cu partea de search. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim search As String = TextBox2.Text Dim i As Long Dim LU, LL As Long LU = UBound(tel) LL = LBound(tel) For i = LL To LU If tel(i) = search Then MessageBox.Show("Student found") TextBox1.Text = fn(i) TextBox3.Text = sn(i) ComboBox1.Text = course(i) End If Next End Sub Nu prea gasesc informatii despre partea cum sterg un string din un array...
  9. JamesBong

    Ajutor Program Visual Basic

    Si cu partea de search am probleme Trebuie sa caut in array dupa numarul de telefon si tot ce imi da este Not Found, nu merge decat prima valoare. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click Dim k As Integer = 0 Dim search As String = TextBox2.Text If search = tel(k) Then MessageBox.Show("Student found") TextBox1.Text = fn(k) TextBox3.Text = sn(k) ComboBox1.Text = course(k) Else MessageBox.Show("Not found") k = k + 1 End If End Sub
  10. JamesBong

    Ajutor Program Visual Basic

    Multumesc pentru ajutor. Am rezolvat cu salvarea datelor in array. Acum incerc sa fac sa mearga cele doua sagetute sa pot da scroll printre studenti si nu reusesc. Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click Dim m As Integer m = 0 TextBox1.Text = fn(m) m = m + 1 End Sub
  11. JamesBong

    Ajutor Program Visual Basic

    Am citit si nu am gasit ceea ce cautam. Vreau sa iau ce e in textbox si sa stochez in array. Prima data merge iar apoi cand apas din nou pe register imi da eroare... Ar fi mai usor daca as folosi database pentru stocarea datelor ?
  12. JamesBong

    Ajutor Program Visual Basic

    Cand incerc sa stochez valorile din textbox imi merge prima data apoi imi da eroare. Un sfat va rog
  13. JamesBong

    Ajutor Program Visual Basic

    Salut Am de facut ca proiect pentru facultate un formular de inregistrare pentru studenti. Ne-a fost schimbat profesorul si acesta nu explica prea bine iar documentatie nu prea gasesc. Stiu chestii basic in C# dar asta este cam grea. Ma puteti ajuta cu niste sfaturi sau de unde sa incep?
×