• Check out all the best Amazon Prime Day deals 2021 here!

here is what i have written so far for your clarification that it not an assignment. Its only a problem in a java ebook.

Udeme107

Estimable
Feb 28, 2014
7
0
4,510
0
Java:
public class Students
{      
	String first;
	String last;
	int age;     
	String complexion;     
	int height;
	int weight;
	double bmi;
	
	Students(String first,
			String last,
			int age,
			String complexion,
			int height,
			int weight,
			double bmi)
	{         
		         
		this.first=first;
		this.last=last;
		this.age=age;         
		this.complexion=complexion;         
		this.height=height;         
		this.weight=weight;         
		this.bmi=bmi;     
	}     
		    
		public String getFirst()
		{         
			return first;     
		}
		public String getLast()
		{
			return last;
		}
		public int getAge()
		{         
			return age;     
		}     
		public String getComplexion()
		{         
			return complexion;     
		}     
		public int getHeight()
		{         
			return height;     
		}     
		public int getWeight()
		{         
			return weight;     
		}     
		public double getBmi()
		{         
			return bmi;    
		} 
	} 







import java.util.*;
public class CalculateGPA
{     
	public static void main(String[] args)
	{
		
		Scanner input=new Scanner(System.in);         
		ArrayList<Students> list=new 
			ArrayList<Students>();         
		int height = 0;
		int weight = 0;
		double bmi = height/  weight;
		for(int i=0; i<5; i++)
		{
			System.out.print("Enter First Name: ");             
			String  firstName=input.next();             
			System.out.print("Enter Last Name: ");             
			String lastName=input.next();             
			System.out.print("Enter Age: ");             
			int age=input.nextInt();             
			System.out.print("Enter Complexion: ");             
			String complexion=input.next();             
			System.out.print("Enter Weight: ");             
			int height=input.nextInt();             
			System.out.print("Enter Weight: ");             
			int weight=input.nextInt();
			
			
			System.out.printf("\nResult: %d / %d = %d\n", height, weight, bmi );
		{
		list.add(new Students (firstName, lastName, age, complexion, height, weight,bmi));         
			}         
		for(Students s: list)
		{             
			System.out.println(s.getFirst()+"\t"+s.getLast()+"\t"+s.getAge() +"\t"+s.getBmi());         
			}     
		} 
	}
}
<MOD EDIT: There, fixed it for you. Next time use the code tags>
 

Udeme107

Estimable
Feb 28, 2014
7
0
4,510
0


i want to write a java program that will receive the first name ,last name,age,complexion (fair/dark),weight (kg)and height (m2) of 5 individuals; calculate their body mass index(BMI) and display each name and their respective information (including the BMI) accordingly. (BMl)=height/weight . So am having problems with the divsion syntax on how to place it on the calculateGPA.class apect. I will be very grateful if you could help me.
 

Udeme107

Estimable
Feb 28, 2014
7
0
4,510
0




thanks you alot for everything
 

Udeme107

Estimable
Feb 28, 2014
7
0
4,510
0
but sir if i try running the program, it tells me that height and weigth is already defined in main(String[]) and i don't if a functions (including main( )) can be used to execute the program and pls can u just correct the lines for me?
 

Ijack

Distinguished
Reproduce the exact error message that you get.

If you are learning Java from an eBook then surely you want to understand what you are doing rather than just being given some working code. I'm afraid it does begin to sound as if this is a class assignment. If not, study the basics again before attempting this excercise.
 

Udeme107

Estimable
Feb 28, 2014
7
0
4,510
0


am using a book title "java-how to program(2009)" and what they did was that the only talked about arraylist without how to add the division, addition or multiplication syntax in an array. So i decided to learn it on my own by the help of search engine and other forum which the have not be able to really explain it for me in details and that is why am desperately in need of help to be able to achieve that which i have spend time and resources looking for to understand it.
 
Thread starter Similar threads Forum Replies Date
K Apps General Discussion 3
L Apps General Discussion 5
D Apps General Discussion 2
M Apps General Discussion 1
L Apps General Discussion 3
C Apps General Discussion 3
S Apps General Discussion 1
7 Apps General Discussion 5
C Apps General Discussion 1
M Apps General Discussion 3
rodion15 Apps General Discussion 1
L Apps General Discussion 2
Mr Davo Apps General Discussion 1
S Apps General Discussion 1
G Apps General Discussion 3
S Apps General Discussion 1
T Apps General Discussion 6
H Apps General Discussion 1
P Apps General Discussion 3
randomizer Apps General Discussion 0

ASK THE COMMUNITY