我的代碼有問題。它不會編譯,每次我嘗試修復它時,都會出現(xiàn)錯誤。我看不出問題是什么。我可能只是俯視或過于努力。自從2006年開始上這堂課以來,我還沒有做過Java編碼。該類在編碼中用的并不多,我正在努力消除我的記憶。自從我一周前編寫代碼以來,我一直在研究該代碼并查看它。有人可以看一下,告訴我我搞砸了嗎。已經(jīng)過期了 我已經(jīng)向老師展示了,但沒有得到任何幫助,并且我的學校目前在這個學期沒有該班的輔導老師。請幫忙!代碼和錯誤如下:錯誤:/** 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錯誤
添加回答
舉報
0/150
提交
取消