Instance variable: int m[11] | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Instance variable: int m[11]

methods: void accept(): to accept marks of 11 subject void compute(): to find percentage void display(): to display percentage This is one of my attempts: https://code.sololearn.com/c8wDX2o0WS1l/?ref=app //how can i accept marks of 11 subject....help me

6th Jun 2018, 4:38 PM
Harsh Agrawal
Harsh Agrawal - avatar
12 Answers
+ 4
tell me.. you facing a problem to take 11 marks of subject
6th Jun 2018, 5:22 PM
Arun Tomar
Arun Tomar - avatar
+ 4
Harsh Agrawal --------------------------------------- Owenizedd give you a way.. you try to understand that.. or give me time.. i provided you some eq.
6th Jun 2018, 5:32 PM
Arun Tomar
Arun Tomar - avatar
+ 3
in the void accept() you have to put loop : for(int i =0; i<m.length; i++) then inside loop use m[i] = Integer.parseInt(sc.nextLine()); where sc is your Scanner object variable name. code: EDIT: you mean passing to the parameter right? i assume you have a class. then it should be pretty easy. public class MyClass{ int[] m = new int[11]; void accept(int[] mt){ m=mt; //accept the mt to m } //.... another method }
6th Jun 2018, 4:44 PM
Owenizedd
Owenizedd - avatar
+ 3
listen first.. when you create a function.. and call through main.. then what instance variables you used in that function.. you dont need anything... to give value wait i creat you program.. give me 5min
6th Jun 2018, 5:38 PM
Arun Tomar
Arun Tomar - avatar
+ 2
check updated answer
6th Jun 2018, 5:27 PM
Owenizedd
Owenizedd - avatar
+ 1
Owenizedd how can i accept dat vaiable
6th Jun 2018, 4:46 PM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
Arun Tomar plzzz give me suggestion or give some eg plzzz
6th Jun 2018, 5:21 PM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
Arun Tomar check my updated question
6th Jun 2018, 5:35 PM
Harsh Agrawal
Harsh Agrawal - avatar
+ 1
Okkk Arun Tomar I m waiting
6th Jun 2018, 5:44 PM
Harsh Agrawal
Harsh Agrawal - avatar
6th Jun 2018, 6:31 PM
Arun Tomar
Arun Tomar - avatar
0
Arun Tomar i just want to know how can i accept d variable of m as it is an array type here i just try but i dont make d whole program as i m confused how i accept m varible so u can understand from my code what i want to do??? https://code.sololearn.com/c8wDX2o0WS1l/?ref=app
6th Jun 2018, 5:31 PM
Harsh Agrawal
Harsh Agrawal - avatar
0
Arun Tomar U dont accept any variable thats not what d program saying plzzz make according to d program I just give an eg to make my question understand properly As like in dis program i accept d variable https://code.sololearn.com/cdSp5HW4xy5K/?ref=app
6th Jun 2018, 6:16 PM
Harsh Agrawal
Harsh Agrawal - avatar