Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

can someone help me compile my code? public class Gpa { public static void main(

ID: 3655013 • Letter: C

Question

can someone help me compile my code? public class Gpa { public static void main( String args[]){ Scanner input = new Scanner(System.in); printgpa(input); } public static void printgpa (Scanner imput){ String name; int test,scores; double average =0.0; System.out.print(" please enter your score"); name= input.next(); test= input.nextInt(); for(int i =0; i<=test; i++) { scores= input.next(); avg= scores; } avg=avg/test; System.out.print(name+"'s grade is" + avg ); } }

Explanation / Answer

import java.util.*; public class Calculate { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Num1: "); int num1 = input.nextInt(); System.out.print("Num2: "); int num2 = input.nextInt(); if (num1 > 0 && num2 > 0) { int sum = num1 + num2; System.out.println("Sum= " + sum); } else { System.out.println("Invalid Numbers"); System.out.println("End of program"); } } }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote