我正在制作一个程序,我正处于一个部分,我想要让用户输入每个法官的分数,但是当它开始时,并要求第一个判断是正确的说"输入法官01的分数"
但当它进入下一个时,它会跳过02并直接进入11,然后是21.我做错了什么?这是该区域的代码行
int[] judge = new int[7];
for(int i = 0; i<judge.length; i++)
{
System.out.println("Enter the difficulty score for each judge (0-10)");
System.out.println("Enter the score for judge" + i+1);
judge[i]=keyboard.nextInt();
while(score > 0 && score <=10);
}
Run Code Online (Sandbox Code Playgroud)
}
我试图修改我的代码以添加GUI,不确定我是否正确执行此操作并收到1错误消息,如下所示:
C:\Documents and Settings\AdminUser\My Documents\InventoryPart4.java:40: invalid method declaration; return type required
public Television(String itemNumber, String televisionName, int unitsinStock, double unitPrice) {
Run Code Online (Sandbox Code Playgroud)
^ 1错误
工具已完成,退出代码为1
如果有人可以查看下面的代码,请告诉我是否按照这些说明正确地进行了修改.GUI应显示清单中的所有项目,并包括项目编号,产品名称,单位数量库存,每个单位的价格以及该产品的库存价值.此外,GUI应显示整个库存的值,附加属性和重新进货费用.所有美元值都应显示为货币(即$ D,DDD.CC).DOS控制台中不应该有任何输出.我真的很努力地把握所有这一切,但如果我做得对,我会感到非常困惑和沮丧.特别是因为我不确定如何修复错误.非常感谢如果有人能够在一天之后给我提供一些意见,并且还有另外两个部分即将推出.
enter code here
Run Code Online (Sandbox Code Playgroud)
//第7周库存计划第4部分//在Television类中存储数据的库存程序//使用GUI返回数据//使用添加的子类Size
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.JPasswordField;
import javax.swing.JOptionPane;
import javax.swing.JLabel;
@SuppressWarnings("serial")
public class Televisions extends JFrame { //class name and attributes
//declare class variables
private String itemNumber; //item # of product
private String televisionName; //product name
public int unitsinStock; //# of units in stock …
Run Code Online (Sandbox Code Playgroud) import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
public class FinalExamClass extends JFrame {
private String strName;
private int intQuantity;
private boolean blnInsurance;
private double dblTotal;
private JPanel panel;
private JLabel nameLabel;
private JLabel quantityLabel;
private JTextField nameText;
private JTextField quantityText;
private JButton searchButton;
private JButton submitButton;
private JButton reportButton;
private JButton clearButton;
private JRadioButton cleaningRadButton;
private JRadioButton fillingRadButton;
private JRadioButton rootRadButton;
private ButtonGroup radioButtonGroup;
private final int WINDOW_WIDTH = …
Run Code Online (Sandbox Code Playgroud) 这是我的第一个编程课程,我想确保我正确地解决了这个问题.如果你能查看我的工作,我将不胜感激.
在给定起始余额和Check对象数组的情况下,编写一种计算并返回支票帐户余额的方法.您可以假设Check类已经存在,并且有一个方法可以从特定的检查对象中获取金额:double getAmount()
数组未满,可能有间隙 - 确保在尝试访问之前测试是否有对象!使您的代码适用于任何长度数组!
该方法的标题是为您提供的:
public double computeBalance(double startingBalance, Check[] register) {
int i = 0; // i must be initialized and declared somewhere at least
double total = 0.0;
while ((i >= check.length) && check[i] != null) { // is >= correct? you do i++!
total = (total + getAmount(check[i])); // should you add/compute somewhere
// the given amounts
i++;
} ?
System.out.println(total);
}
Run Code Online (Sandbox Code Playgroud)