帮助我如何运行代码? [英] HELP on how I make my coding run?

查看:115
本文介绍了帮助我如何运行代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

//凯文·卡罗利(Kevin Caroli)
//IST140
//项目5

//Kevin Caroli
//IST140
//Project 5

import java.util.Scanner;
public class Project5 
{

	public static void main(String[] args) 
	{
		Scanner testscore = new Scanner(System.in);
		
		char a = 0;
		
	}
	
	
		
	private static char testscore(double number)
	{
		
		char b = 0;
		do
		{
			System.out.print("Enter the Test Score: ");
			Scanner testscore;
			if (testscore.hasNextDouble())
		
			{
			double x = testscore.nextDouble();
			if (x >= 100)
			{
				System.out.println("Enter number between 0 and 100");
			}
		
			else if (x >= 90)
			{
				System.out.print("The letter grade is A");
			}
			else if (x >= 80)
			{
				System.out.print("The letter grade is B");
			}
			else if (x >= 70)
			{
				System.out.print("The letter grade is C");
			}
			else if (x >= 60)
			{ 
				System.out.print("The letter grade is D");
			}
			else  if (x >= 0)
			{
				System.out.print("The letter grade is F");
			}
			
			else
			{
				System.out.println("Error: Not an integer");
			}
			
			while(testscore.equals ("Y"));         
			{
			System.out.println("Come back next time");
			}
		}
	}
	}


我放入的括号引起很多语法错误

我尝试过的事情:

更改括号并声明变量


The brackets I am putting in are causing a lot of syntax errors

What I have tried:

changing brackets and declaring variables

推荐答案

您好,请检查我现在解析语法,您的代码中存在某些语法错误.

Hi please check now I resolve syntax,there are some syntax error in your code.

import java.util.Scanner;
public class Project5 
{
 
	public static void main(String[] args) 
	{
		Scanner testscore = new Scanner(System.in);
		
		char a = 0;
		
	}
		
	private static char testscore(double number)
	{
		
		char b = 0;
		do
		{
			System.out.print("Enter the Test Score: ");
			Scanner testscore;
			if (testscore.hasNextDouble())
			{
				double x = testscore.nextDouble();
				if (x >= 100)
				{
					System.out.println("Enter number between 0 and 100");
				}
			
				else if (x >= 90)
				{
					System.out.print("The letter grade is A");
				}
				else if (x >= 80)
				{
					System.out.print("The letter grade is B");
				}
				else if (x >= 70)
				{
					System.out.print("The letter grade is C");
				}
				else if (x >= 60)
				{ 
					System.out.print("The letter grade is D");
				}
				else  if (x >= 0)
				{
					System.out.print("The letter grade is F");
				}
				
				else
				{
					System.out.println("Error: Not an integer");
				}
		    }
		}
			
		while(testscore.equals ("Y"));         
		{
			System.out.println("Come back next time");
		}
	}
}


这篇关于帮助我如何运行代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆