Search:

Type: Posts; User: melki0795

Page 1 of 2 1 2

Search: Search took 0.47 seconds.

  1. Replies
    8
    Views
    165

    [SOLVED] Re: Output in columns

    thanks man, I got it, I always used to find formatting a bitch heh.

    Thanks
  2. Replies
    8
    Views
    165

    [SOLVED] Re: Output in columns

    and would this work, if t[i] are Strings of different lengths? What is happening, is that my output is shifting here and there.

    2750

    This is the Format string i used: String formatString = "...
  3. Replies
    8
    Views
    165

    [SOLVED] Re: Output in columns

    I did, but when I use them, all i get is the t[i] written in a line :/



    for(int i = 0; i < 5; i++) {
    System.out.printf(title[i],"%20s", name[i], "%20s",subAmounts[i]);
    }
  4. Replies
    8
    Views
    165

    [SOLVED] Re: Output in columns

    Just outputs all messed up o.O
  5. Replies
    8
    Views
    165

    [SOLVED] Output in columns

    Hi,

    Any way i can format this output into columns?



    for(int i = 0; i < 5; i++) {
    System.out.println(t[i]+n[i]+s[i]);
    }
  6. Replies
    11
    Views
    199

    Re: Nested For...each Loop?

    Yes we are, haha.

    Ok, so basically...If The user enters the the marks for the first subject.... (example: 20, 30 and 40)
    The enters the marks for the second subject ( example 50, 60 and 70);
    ...
  7. Replies
    11
    Views
    199

    Re: Nested For...each Loop?

    I need that it works out the addition of both arrayLists of the subject together. SO i can work out an overall average.

    Example: I'm malcolm, and I have 2 subjects... English and Maltese. I need...
  8. Replies
    11
    Views
    199

    Re: Nested For...each Loop?

    The user must... enter name, surname student number.... thats one class...

    then it asks him to enter marks for hw and exams for one subject, so thats an instance of subject...in array sub...
    ...
  9. Replies
    11
    Views
    199

    Re: Nested For...each Loop?

    still cannot get it... this is my full class...


    import java.util.ArrayList;
    public class Subject
    {
    int subjectNumber;
    ArrayList<Double> homeworkMark;
    ArrayList<Double>...
  10. Replies
    11
    Views
    199

    Re: Nested For...each Loop?

    At this point I have one instance of "student".. If the student adds more than one subject, I need to add the homeworkMark of both instances of "student"... Lets say I have

    A student who decides...
  11. Replies
    11
    Views
    199

    Nested For...each Loop?

    Hi, I have 3 classes in My Program. One is the Main class, another class for students and another class for the subjects and their marks, which are store in arrayLists....

    When the student enters...
  12. Replies
    3
    Views
    142

    ArrayLists and Classes

    Hi, I have this piece of code, which adds marks into 2 different arrayLists, one for homework marks, and one for examination marks..





    ArrayList<Double> homeworkMark = new...
  13. Replies
    4
    Views
    187

    Re: Removing the import function.

    So close :(

    Thanks
  14. Replies
    4
    Views
    187

    Re: Removing the import function.

    don't have a java compiler with me, it was a written exam, not on a computer...
  15. Replies
    4
    Views
    187

    Removing the import function.

    Hi!

    I just an exam and I was given a program where it imported the the java util scanner.

    The code was something like this



    import java.util.Scanner;
    class A {
  16. Re: WHy is it going straight to my exception?

    ah, i get it.. so the number is being accepted as a string and parsed into an integer. The string is forcing it to go straight to the exception?

    It works with .nextInt();

    Thanks!
  17. Re: WHy is it going straight to my exception?

    ok, i did that. no idea whats its on about though

    java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at...
  18. WHy is it going straight to my exception?

    boolean markCheck = true;
    do{
    try{
    for (int i = 0; i <= amountAssignment-1; i++ ) {
    System.out.print("Homework Mark for Assignment " +(i+1) + ": ");
    ...
  19. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    is it possible to put an array in a method, and have the same recursion call? how would the variable be returned in that case?
  20. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    any ideas?
  21. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    what are the benfits of a loop from a recursive call?

    and any idea how i can apply the same concepts to a array, with 2 outputs?




    double [] homeworkMark = new double[amountAssignment];
    ...
  22. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    it was because of the integer parsing

    Solution




    public static int numberEntered = 0;
    public static int studentNumberEntered(Scanner sc) {
  23. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    public static int studentNumberEntered(int number, Scanner sc) {
    int numberEntered = 0;
    sc.reset();
    try {
    System.out.print("Student Number: ");
    numberEntered =...
  24. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    So this will just let me show an error right? i cannot really loop back... i think
  25. Replies
    20
    Views
    242

    Re: Rejecting certain inputs

    Haven't learnt GUI's in Java yet!

    Could you give me an example of what you mean?

    Thanks!
Results 1 to 25 of 49
Page 1 of 2 1 2