Posts

Showing posts from June, 2022

Simple Report Card in Java

Image
A Simple Report Card in Java I learned Java last semester, so I thought I should make a project. I searched on Google for Java projects and I found: Write a program to take marks of 2 subjects from the user and display the Total, Percentage, Highest Marks, Average, and Remarks. It was not that tough, so this is how I made it. First, I imported this library for taking input from users: import java.util.Scanner; Then, I created the file named ‘marks’. I know this file name doesn’t make sense but it’s ok. Java starting Template: public class marks { public static void main(String args[]) { // Code Here } } Starting with my code, I defined Scanner Class a variable ‘sc’ to make it easy to get input from the user try (Scanner sc = new Scanner(System.in)) { // Code Here } I put the above variable in ‘try’ because Visual Studio was giving errors. Next, I displayed in the console what I want from them: System.out.println("Enter the marks of 2 subject