0

Hi I need help.there is one error in it plzz help me to solve this I have to submit it till 9o'clock

class Result_Card { int English; int Islamiat; int Math; int english(int eng){ English = eng; return English; } int islamiat(int isl){ Islamiat = isl; return Islamiat; } int math(int math){ Math = math; return Math; } int total(){ return English + Islamiat + Math; } float average(){ return ((English + Islamiat + Math)*100)/300; } class Main { //main method public static void main(String[] args){ Result_Card Subject = new Result_Card(); System.out.println(Subject.english(50)); System.out.println(Subject.islamiat(60)); System.out.println(Subject.math(70)); System.out.println("Total: " + Subject.total()); System.out.println("Average: " + Subject.average() + "%"); } } }

25th Apr 2022, 2:19 AM
kalsoom akhtar
kalsoom akhtar - avatar
2 odpowiedzi
0
// delete last } in code, and add one at this place: } } // added here class Main {
25th Apr 2022, 5:00 AM
zemiak
0
class Result_Card { int English; int Islamiat; int Math; int english(int eng){ English = eng; return English; } int islamiat(int isl){ Islamiat = isl; return Islamiat; } int math(int math){ Math = math; return Math; } int total(){ return English + Islamiat + Math; } float average(){ return ((English + Islamiat + Math)*100)/300; } } class Main { //main method public static void main(String[] args){ Result_Card Subject = new Result_Card(); System.out.println(Subject.english(50)); System.out.println(Subject.islamiat(60)); System.out.println(Subject.math(70)); System.out.println("Total: " + Subject.total()); System.out.println("Average: " + Subject.average() + "%"); } } There is nothing wrong with code. There is a curly braces error.
25th Apr 2022, 7:27 AM
Thineshan Panchalingam
Thineshan Panchalingam - avatar