-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgrammingLanguage.java
More file actions
28 lines (26 loc) · 1.04 KB
/
Copy pathProgrammingLanguage.java
File metadata and controls
28 lines (26 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Represents a programming language as a datapoint with difficulty and readability scores.
* Inherits from Datapoint.
* @author Showmick Das
* @version 1.0
*/
public class ProgrammingLanguage extends Datapoint {
private static int numDefaultLanguages = 0;
/**
* Constructs a ProgrammingLanguage with the specified name, difficulty, and readability.
* @param name The name of the programming language.
* @param difficulty The difficulty score.
* @param readability The readability score.
*/
public ProgrammingLanguage(String name, double difficulty, double readability) {
super(name, new double[]{difficulty, readability}, new String[]{"difficulty", "readability"});
}
/**
* Default constructor that assigns a unique default name and random difficulty and readability scores.
* The name is in the format "C{numDefaultLanguages}".
*/
public ProgrammingLanguage() {
this("C" + numDefaultLanguages, Math.random() * 5.0, Math.random() * 5.0);
numDefaultLanguages++;
}
}