我的代码有问题。它不会编译,每次我尝试修复它时,都会出现错误。我看不出问题是什么。我可能只是俯视或过于努力。自从2006年开始上这堂课以来,我还没有做过Java编码。该类在编码中用的并不多,我正在努力消除我的记忆。自从我一周前编写代码以来,我一直在研究该代码并查看它。有人可以看一下,告诉我我搞砸了吗。已经过期了 我已经向老师展示了,但没有得到任何帮助,并且我的学校目前在这个学期没有该班的辅导老师。请帮忙!代码和错误如下:错误:
/*
* File: Guitar2.java
* Author: Eppards,Michael
* Date: June 11, 2018
*/
class Guitar2 {
private int numStrings;
private double guitarLength;
private Color guitarColor;
private Manufacturer guitarManufacturer;
enum Manufacturer {
GIBSON,
FENDER,
IBANEZ;
}
enum Color {
RED,
BLUE,
BLACK;
}
// Default Constructor
private Guitar2() {
this.numStrings = 6;
this.guitarLength = 28.2;
this.guitarColor = Color.RED;
this.guitarManufacturer = Manufacturer.GIBSON;
}
// Argument Constructor
private Guitar2(int numStrings, double guitarLength, Color guitarColor, Manufacturer guitarMaker) {
this.numStrings = numStrings;
this.guitarLength = guitarLength;
this.guitarColor = guitarColor;
this.guitarManufacturer = guitarMaker;
}
// Getters
public int getNumStrings() {
return numStrings;
}
public double getGuitarLength() {
return guitarLength;
}
public Color getGuitarColor() {
return guitarColor;
}
public Manufacturer getGuitarManufacturer() {
return guitarManufacturer;
}
// playGuitar method for 16 randomly selected musical notes
enum Notes {
A(1),
B(4),
C(1),
D(2),
E(0.25),
F(0.5),
G(0.5);
double duration;
private Notes(double duration) {
this.duration = duration;
}
}
Guitar2.java:80:错误:找不到符号Random rn = new Random(); ^符号:类随机位置:类Guitar2 Guitar2.java:80:错误:找不到符号Random rn = new Random(); ^符号:类随机位置:类Guitar2 2错误
相关分类