-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHeadline.java
More file actions
51 lines (50 loc) · 1.2 KB
/
Copy pathHeadline.java
File metadata and controls
51 lines (50 loc) · 1.2 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
public class Headline{
//takes components of headline
Headline(String n, String v, double w, boolean cM, String nm){
noun = n;
verb = v;
worth = w;
changesMomentum = cM;
genBeginning();
genSentence();
name = nm;
}
//instance variables
String noun;
String verb;
String name;
double worth;
boolean changesMomentum;
String beginning;
String sentence;
//randomly creates opening
private void genBeginning(){
int rnd = (int)( Math.random() * 10);
if (rnd == 0){
beginning = "THIS JUST IN:";
}
if (rnd == 1){
beginning = "NEW NEWS:";}
if (rnd == 2){
beginning = "BREAKING NEWS:";}
if (rnd == 3){
beginning = "EXCITING DEVELOPMENT:";}
if (rnd == 4){
beginning = "IMPORTANT!:";}
if (rnd == 5){
beginning = "CAN YOU BELIEVE IT?:";}
if (rnd == 6){
beginning = "AMAZING:";}
if (rnd == 7){
beginning = "NEWS UPDATE:";}
if (rnd == 8){
beginning = "HAPPENING NOW:";}
if (rnd == 9){
beginning = "EXCITING NEWS:";}}
//puts components together
private void genSentence(){
sentence = beginning + " " + noun + " about to " + verb + ".";}
// returns sentence
public String toString(){
return sentence;}
}