Java Not running

Java Not running

View Answers

December 15, 2009 at 2:34 PM

Hi Friend,

Try the following code:

public class Grader {

public static double find() {

double grades[] = {79, 70, 69, 60, 50, 40};
String final_grade;
double sum, average;
sum = 0;

for (int i = 0; i < grades.length; i++) {
sum += grades[i];
}

average = sum / grades.length;
System.out.println("Average grade = " + average);
return average;
}

public static void main(String[] args) {
Grader g=new Grader();
double average=g.find();
if (average > 70) {
System.out.print("Your Final Grade is A");
} else if ((average > 60) && (average <70)) {
System.out.print("Your Final Grade is B");
} else if ((average >50) && (average < 60)) {
System.out.print("Your Final Grade is C");
} else if ((average >40) && (average < 50)) {
System.out.print("Your Final Grade is D");
} else if (average <40) {
System.out.print("Sorry you not part here, Failed");
}
}
}

Thanks









Related Tutorials/Questions & Answers:
Running Java Applications as software
Running Java Applications as software   Please tell me what to do if you want your java application to run like a real software,eg a java GUI application that connects to the database(Mysql)running on the computer like any other
running java with classpath in cygwin
running java with classpath in cygwin  The following command works in cmd.exe but failts in cygwin shell. java -cp .;oracle.jar;mysql.jar Executecmd query value; how should i alter the command to run in the bash shell?thanks
Advertisements
Running core java program
Running core java program  I am jayesh raval. I am going to make simplae program and at the time of runnint that program I found class not found exception. I have clear source of that program and that is right in the syntax. so
process of compiling and running java program
process of compiling and running java program  Explain the process of compiling and running java program. Also Explain type casting
Java Not running - Java Beginners
Java Not running  Hi, I tried to create a grade(type array) and final_grade (type of String) program using getter/setter but not want a public setter method for final_grade; Here is my program that calcuate the average of all
Running Java Applications as a Windows Service
Running Java Applications as a Windows Service  sample code for "Run a Java application as a Windows Service
Building and Running Java 8 Support
Building and Running Java 8 Support  As you know Java 8 is already released and available for download. Now I am developer of Java based projects. So... and run Java 8 application in Eclipse? Thanks   Hi, don't worry
Server running Button - Java Beginners
Server running Button  Hi there, I have a created a GUI using NetBeans IDE 6.1. The aim of this interface is to display the messages that have been recived by the server , when the client is connected , in the textArea
Java Compilation and running error - RMI
Java Compilation and running error   The following set of programs runs with the lower versions of Java 6 update 13, but not with JAVA 6 update 13... some problem and gives following on compilation"java uses unchecked or unsafe
Running Batch files in java - Java Beginners
are sending you some sample program code for running batch (.bat) file in Java. We have...Running Batch files in java  Hi, I am writing a program which... and every line from the batch file and execute it line by line in java. Is anyone
java web application without running tomcat
java web application without running tomcat  I did a project by using jsp,html,javascript,css,tomcat,editplus and MSAccess as backend..i created set... is there any way to run the web application(only in single system)without running
Trouble in running Dos Command from Java Servlet
Trouble in running Dos Command from Java Servlet  Hello All, I have to run following command from Java. The command is : vscanwin32 /S C:\Test > C... 'cmd /c dir /s'. Looking forward for the help. -Java Beginner
error while running the applet - Java Beginners
error while running the applet  import java.applet.Applet; import...); ++num; } } } } i have problem while running the code , error... is correct but u have problem in running the program. You follow the following steps
Compiling and Running Java program from command line
Compiling and Running Java program from command line - Video tutorial... of compiling and running java program from command line. We have also video... to explain you the process of compiling and running the Java program from command
Running JUnit
Running JUnit  Hi sir How can we run JUnit or Run test case Using JUnit using command prompt or CMD? Is there any alternate way of running test cases?   ou can run JUnit test case by running following command on CMD
How to Communicate with the operating system embedded on processor running on hardware machine in java
How to Communicate with the operating system embedded on processor running... system embedded on processor running on hardware machine .Now as per my need i have to communicate with the opearating system using java tools. Will you plz
Running JUnit
Running JUnit  Hi sir How can we run JUnit or Run test case Using JUnit using command prompt or CMD? Is there any alternate way of running test cases?   Hi friendADS_TO_REPLACE_1 You can run JUnit test case by running
How to Get currently running processes in a tabular form in java
How to Get currently running processes in a tabular form in java  I need to create a frame that shows all the current running processes in the system in a tabular form. i used Process proc = runtime.exec(cmds); but it only gives
why it is very slow when I am using the backend as microsoft access file for running the java webapplication - SQL
why it is very slow when I am using the backend as microsoft access file for running the java webapplication  I am using the backend as microsoft access file for running the java webapplication.it is very slow when twoor mor
Running Jar file in Windows
Running Jar file in Windows  Running Jar file in Windows
i want to copy files from one machine to other using java and the code will be running on third machine
i want to copy files from one machine to other using java and the code will be running on third machine  i want to copy some files from one machine say 'A' to some other machine say 'B' by using the java program running on third
problem running a servlet on tomcat.
problem running a servlet on tomcat.  i have followed the steps given... suppose that should mean that my tomcat server is up and running. but whn i try..., the browser responds "HTTP Status 404 - /java_mail/hello" wht could
running time watch
running time watch   how to set running watch in applycation with ajax
applet is running but no display
applet is running but no display  applet is running but no display.. its showing white screen with applet started
ModuleNotFoundError: No module named 'running'
ModuleNotFoundError: No module named 'running'  Hi, My Python... 'running' How to remove the ModuleNotFoundError: No module named 'running... to install padas library. You can install running python with following command
program is not running in Eclipse.... - WebSevices
program is not running in Eclipse....  Hi i following the tutorial for eclips in roseindia. I am able to creat the simple java application but when i am clicking windows->show view->console then i am getting the console
RUNNING EJB PROGRAMS
RUNNING EJB PROGRAMS  how to run ejb programs using weblogic in windowsxp
stop the running hidden server
stop the running hidden server  Port 8080 required by Tomcat v6.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you
Running faces config file without using internet - Java Server Faces Questions
Running faces config file without using internet  how i can run faces config file without using live internet i have put "web-facesconfig_1_1.dtd" file at local path while i run the jboss,it will throw exception
applet running but no display - Applet
applet running but no display  Hai, Thanks for the post. I have applied the codebase url in the page and executed. Now, when accessed the page... strDefault = "Hello! Java Applet."; public void paint(Graphics g) { String
Find the Running time in sql***
Find the Running time in sql***  I have 10 backend jobs in sql which...:00ADS_TO_REPLACE_1 I want to find the running time of both the jobs. (i.e when i run the query it should show me how long job has been running) Eg:- Lets consider
About running the Applet Program
About running the Applet Program  Hi I have composed an Applet Program and compiled the program, until that it is fine but how to run the Applet program(compiling i typed as javac AppletDemo.java)? Is compiling
About running the Applet Program
About running the Applet Program  Hi I have composed an Applet Program and compiled the program, until that it is fine but how to run the Applet program(compiling i typed as javac AppletDemo.java)? Is compiling
While running jsp
While running jsp  I found this error when i run the client.jsp can anyone help me javax.xml.ws.WebServiceException: Failed to access the WSDL at: http://localhost:8080/WebService1/MyWebService?wsdl. It failed with: http
About running the Tomcat Server
About running the Tomcat Server   HI I want to run a simple program on servlet and the application is a simple program Hello world... and i got /myaps directory now i clicked on /myapps and got html file,java,file
Running and deploying Tomcat Server
Running and deploying Tomcat Server  HI Somebody has given the solution but it doesn't work out. kindly tell the solution for my problem which i... and i got /myaps directory now i clicked on /myapps and got html file,java,file
Error running webservice
Error running webservice  Hi, I am getting following error: 05/10 12:45:46 ERROR org.springframework.web.context.ContextLoader - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error
ModuleNotFoundError: No module named 'running-performance'
ModuleNotFoundError: No module named 'running-performance'  Hi, My... named 'running-performance' How to remove the ModuleNotFoundError: No module named 'running-performance' error? Thanks   Hi
ModuleNotFoundError: No module named 'running-stats'
ModuleNotFoundError: No module named 'running-stats'  Hi, My... 'running-stats' How to remove the ModuleNotFoundError: No module named 'running-stats' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'running-metco'
ModuleNotFoundError: No module named 'running-metco'  Hi, My... 'running-metco' How to remove the ModuleNotFoundError: No module named 'running-metco' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'running-performance'
ModuleNotFoundError: No module named 'running-performance'  Hi, My... named 'running-performance' How to remove the ModuleNotFoundError: No module named 'running-performance' error? Thanks   Hi
ModuleNotFoundError: No module named 'running-stats'
ModuleNotFoundError: No module named 'running-stats'  Hi, My... 'running-stats' How to remove the ModuleNotFoundError: No module named 'running-stats' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'keep-running'
ModuleNotFoundError: No module named 'keep-running'  Hi, My Python... 'keep-running' How to remove the ModuleNotFoundError: No module named 'keep-running' error? Thanks   Hi, In your python
Running problem with NoughtsAndCrossesGame in blank
Running problem with NoughtsAndCrossesGame in blank  Hi i was having problem created NoughtsAndCrossesGame in end the it works but i runs the gui in blank. Its another way to solve it /* * To change this template, choose
You Spring Project is not running
:\Program Files\Java\jdk1.8.0_91\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C...\dbhome_1\bin;C:\Program Files\Java\jdk1.8.0_91\bin;C:\Windows\system32;C:\Windows;C
how to list running containers in docker
how to list running containers in docker  Hi, I have a docker installation and many images are running on it. This is testing machine where I am... and images running in my machine. how to list running containers in docker? Try
Running the application
Running the Application      If you have completed previous steps of the application, this is the last step to see this application running on the browser. Just follow the steps
how to solve 'Stop Running This Script' Error ?
how to solve 'Stop Running This Script' Error ?  Hi.. When opened the page on IE browser(version : 8.0),it gives an java script error (i.e.Stop Running This Script). I have used jsp/servlet for this. Please help to resolved
J2EE Tutorial - Running RMI Example
J2EE Tutorial - Running RMI Example    ... for running this program.    We create a folder in c:\jdk1.3\bin...!) (continuously). >java -Djava.naming.factory.initial
ModuleNotFoundError: No module named 'running-results-fetcher'
ModuleNotFoundError: No module named 'running-results-fetcher'  Hi...: No module named 'running-results-fetcher' How to remove the ModuleNotFoundError: No module named 'running-results-fetcher' error? Thanks   

Ads