thanks man, I got it, I always used to find formatting a bitch heh.
Thanks
Type: Posts; User: melki0795
thanks man, I got it, I always used to find formatting a bitch heh.
Thanks
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 = "...
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]);
}
Just outputs all messed up o.O
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]);
}
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);
...
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...
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...
...
still cannot get it... this is my full class...
import java.util.ArrayList;
public class Subject
{
int subjectNumber;
ArrayList<Double> homeworkMark;
ArrayList<Double>...
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...
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...
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...
So close :(
Thanks
don't have a java compiler with me, it was a written exam, not on a computer...
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 {
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!
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...
boolean markCheck = true;
do{
try{
for (int i = 0; i <= amountAssignment-1; i++ ) {
System.out.print("Homework Mark for Assignment " +(i+1) + ": ");
...
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?
any ideas?
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];
...
it was because of the integer parsing
Solution
public static int numberEntered = 0;
public static int studentNumberEntered(Scanner sc) {
public static int studentNumberEntered(int number, Scanner sc) {
int numberEntered = 0;
sc.reset();
try {
System.out.print("Student Number: ");
numberEntered =...
So this will just let me show an error right? i cannot really loop back... i think
Haven't learnt GUI's in Java yet!
Could you give me an example of what you mean?
Thanks!