Skip to content
Snippets Groups Projects
Verified Commit a51bf285 authored by Matthew Wang's avatar Matthew Wang
Browse files

Generate (and require) alt text for images

parent 5184500e
No related branches found
No related tags found
No related merge requests found
Pipeline #575985 passed
...@@ -3,18 +3,24 @@ public class Employee { ...@@ -3,18 +3,24 @@ public class Employee {
public String position; public String position;
public String description; public String description;
public String picture; public String picture;
public String altText;
public Employee(String name, String position, String description, String picture) { public Employee(String name, String position, String description, String picture, String altText) {
this.name = name; this.name = name;
this.position = position; this.position = position;
this.description = description; this.description = description;
this.picture = picture; this.picture = picture;
this.altText = altText;
} }
public String getName() { public String getName() {
return this.name; return this.name;
} }
public String getAltText() {
return this.altText;
}
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
......
...@@ -30,6 +30,7 @@ public class GenerateStaff { ...@@ -30,6 +30,7 @@ public class GenerateStaff {
String description = p.getDescription(); String description = p.getDescription();
String picture = p.getPicture(); String picture = p.getPicture();
String position = p.getPosition(); String position = p.getPosition();
String altText = p.getAltText();
// Create new file // Create new file
File employeeFile = new File("staff/" + name + ".html"); File employeeFile = new File("staff/" + name + ".html");
...@@ -42,7 +43,7 @@ public class GenerateStaff { ...@@ -42,7 +43,7 @@ public class GenerateStaff {
outEmployeeFile.println(indent(3) + listStart); outEmployeeFile.println(indent(3) + listStart);
outEmployeeFile.println(indent(4) + itemStart + "<span class=\"about\">Position: " + position + "</span>" + itemEnd); outEmployeeFile.println(indent(4) + itemStart + "<span class=\"about\">Position: " + position + "</span>" + itemEnd);
outEmployeeFile.println(indent(4) + itemStart + "<span class=\"about\">About: " + description + "</span>" + itemEnd); outEmployeeFile.println(indent(4) + itemStart + "<span class=\"about\">About: " + description + "</span>" + itemEnd);
outEmployeeFile.println(indent(4) + "<img src=\"" + "../images/staff/" + picture + "\" target=\"_blank\"></img>"); outEmployeeFile.println(indent(4) + "<img src=\"" + "../images/staff/" + picture + "\" target=\"_blank\" alt=\"" + altText + "\"></img>");
outEmployeeFile.println(indent(3) + listEnd); outEmployeeFile.println(indent(3) + listEnd);
printFooter(outEmployeeFile); printFooter(outEmployeeFile);
......
...@@ -2,12 +2,14 @@ public class Product { ...@@ -2,12 +2,14 @@ public class Product {
public String name; public String name;
public String description; public String description;
public String picture; public String picture;
public String altText;
public double price; public double price;
public Product(String name, String description, String picture, double price) { public Product(String name, String description, String picture, String altText, double price) {
this.name = name; this.name = name;
this.description = description; this.description = description;
this.picture = picture; this.picture = picture;
this.altText = altText;
this.price = price; this.price = price;
} }
...@@ -15,6 +17,10 @@ public class Product { ...@@ -15,6 +17,10 @@ public class Product {
return this.name; return this.name;
} }
public String getAltText() {
return this.altText;
}
public String getDescription() { public String getDescription() {
return this.description; return this.description;
} }
......
/* check out these products! */ /* check out these products! */
public class Products { /* a good class, but not as good as cse391 */ public class Products { /* a good class, but not as good as cse391 */
public Product joshsProduct() { public Product joshsProduct() {
return new Product("Dirt", "The good stuff", "dirt.jpeg", 0.0); return new Product(
"Dirt",
"The good stuff",
"dirt.jpeg",
"some normal brown dirt",
0.0
);
} }
} }
public class Staff { public class Staff {
public Employee faangPup() { public Employee faangPup() {
return new Employee("Steve", "Company Pup", "Provides Moral Support", "pup.jpg"); return new Employee(
"Steve",
"Company Pup",
"Provides Moral Support",
"pup.jpg",
"the goodest boi"
);
} }
public Employee cjobes() { public Employee cjobes() {
return new Employee("Colton", "Lead Naps Analyst", "What do you mean I'm not valuable to the company?", "colton.jpg"); return new Employee(
"Colton",
"Lead Naps Analyst",
"What do you mean I'm not valuable to the company?",
"colton.jpg",
"Colton smiling with a forest in the background"
);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment