Create a program that asks users to enter the name of their favorite team. Have
ID: 440492 • Letter: C
Question
Create a program that asks users to enter the name of their favorite team. Have the program display this team's name. Then have program ask the user to enter the name of their five previous oponents, how many points the team scored, and how many points the opponent scored. Have the program display the name of the opponent the score and the margin of victory (will be negative number if they lost). Have the program total the margin of victory of all games and display at the bottom. Ex print out: PENGUINS Opponent PenguinsScore Opponent Score Margin of Victory Rangers 6 3 3 Flyers 3 1 2 Total Margin of Victory 5Explanation / Answer
mport 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"); } } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.