Create a software system that takes in the number of goals and points scored in a game of Hurling. A goal is treated as 3 points, each point being equal to a value of 1. The system should then calculate the total number of points scored, and display the result
Download source code here
// Start of code--------------------- import java.util.Scanner; /* Usage notes: * Redistribution, alteration and use of this code with or without * modification, are permitted provided that the following conditions * are met: * * In no event shall the copyright owner be liable for any direct, indirect, * incidental, special, exemplary, or consequential damages arising in any * way out of the use of this software, even if advised of the possibility * of such damage. */ public class GAAcalc { /*Brief description: *Read the goals and points *Each goal amounts to three points *Calculate the total points scored by adding goals*3 + points */ public static void main(String[] args) Scanner keyboard = new Scanner(System.in); int goals, points, result; System.out.println("Enter goals scored: (Numeric digits only) "); goals = keyboard.nextInt(); System.out.println("Enter points scored: (Numeric digits only) "); points = keyboard.nextInt(); System.out.println("Total points scored: "); result = goals*3 + points; System.out.println(result); } } // End of code--------------------- |
![]() | |
| Screenshot |
