Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I\'m trying to run this code on java but it show this: the code DalmutiCard.java

ID: 3875328 • Letter: I

Question

I'm trying to run this code on java but it show this:

the code

DalmutiCard.java


public class DalmutiCard {
private String cardName;
private int cardRank;
public DalmutiCard(int cardRank) {
setCard(cardRank);
}
public String getCardName() {
return cardName;
}

public int getCardRank() {
return cardRank;
}
public void setCard(int cardRank) {
if(cardRank < 1 || cardRank > 13) {
this.cardRank = 0;
this.cardName = "Unknonwn";
}
else {
this.cardRank = cardRank;
String cardNames[] = {"", "Dalmuti", "Archbishop", "Earl Marshal", "Baroness", "Abbess", "Knight",
"Seamstress", "Mason", "Cook", "Shepherdess", "Stonecutter", "Peasant", "Jester"};
this.cardName = cardNames[cardRank];
}
}
@Override
public String toString() {
return cardRank + " - " + cardName;
}
}

Command Prompt 09/16/2017 08:37 PM 09/16/2017 08:37 PM 07/27/2017 05:24 PM 11/26/2017 05:08 PM 10/18/2017 05:58 PM 222 PLAYERUNKNOWN'S BATTLEGROUNDS (Test Server).url 222 PLAYERUNKNOWN 'S BATTLEGROUNDS.url 222 Rocket League.url 222 Rust.url 2,283 Stremio.lnk 351,826 bytes 16 File(s) 9 Dir(s) 475,308,486, 656 bytes free C: UsersBassamDesktop>cd java C: UsersBassamDesktopjava>dir Volume in drive Chas no label. Volume Serial Number is 28FC-3BD5 Directory of C:UsersBassamDesktopjava 01/13/2018 02:59 PM 01/13/2018 02:59 PM 01/13/2018 02:59 PM 711 DalmutiCard.java 1 File(s) 711 bytes 2 Dir(s) 475,308,486, 656 bytes free C: UsersBassamDesktop java javac DalmutiCard.java :UsersBassamDesktopjava java DalmutiCard Error: Main method not found in class DalmutiCard, please define the main method as public static void main (Stringl] args) r a JavaFX application class must extend javafx.application.Application :UsersBassam Desktopjava>

Explanation / Answer

Basically to execute a Java file there should be a main method in the class so you should have a main method with signature as shown in the error.

So just add a main method in which you can make an object of your class and test the methods that you have implemented in the class.