Oracle Java 17 Developer Certification
Mohamed Youssfi, Enseignant Chercheur ENSET Mohammedia, Université Hassan II de Casablanca Consultant R&D Ingénierie Logicielle
Class, Object
Interfaces
Generics
Inheritance
Collections
Records
Arrays, Loops
Lambda Expressions Java Streams API
Exception Handling
Java IO API
Java Concurrency & Multi Threading
Modules
Annotations
JDBC API
Java Security
Create New Project
Rename Main Class to Shop
Create New Package : labs.pm.app. And Move the Shop class to this package
Create a File Header Content for All Java Files
Create A New Copyright for this Project : The name of the copyright is : Oracle
Insert thencontent of the copy right
Since: $today.format("MMMM") $today.year
Author: $username
Name: $file.fileName
Description:
Copyright $today.year Gerald Venzl
Licensed under the Oracle License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.oracle.com/
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Copyright Example
Assign the copyright the this project
Create New Java Class : Product in a specific package
Practices 03 – Object Classe : Part 1
package labs.pm.data;
import java.math.BigDecimal;
/**
* @author mohamedyoussfi
**/
public class Product {
private int id;
private String name;
private BigDecimal price;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public BigDecimal getPrice() {
return price;
}
public void setPrice(BigDecimal price) {
this.price = price;
}
}
package labs.pm.app;
import labs.pm.data.Product;
import java.math.BigDecimal;
public class Shop {
public static void main(String[] args) {
Product p1 = new Product();
p1.setId(1);
p1.setName("Tea");
p1.setPrice(BigDecimal.valueOf(1.8));
System.out.println(p1.getId()+" "+p1.getName()+" "+p1.getPrice());
}
}
1 Tea 1.8
Java Source Code
Practices 03 – Object Classe : Part 2
public void setPrice(BigDecimal price) {
price = BigDecimal.ONE;
this.price = price;
}
package labs.pm.app;
import labs.pm.data.Product;
import java.math.BigDecimal;
public class Shop {
public static void main(String[] args) {
Product p1 = new Product();
p1.setId(1);
p1.setName("Tea");
p1.setPrice(BigDecimal.valueOf(1.8));
System.out.println(p1.getId()+" "+p1.getName()+" "+p1.getPrice());
}
}
1 Tea 1
Java Source Code
public void setPrice(final BigDecimal price) {
//price = BigDecimal.ONE;
this.price = price;
}
1 Tea 1.8
Practices 03 – Object Classe : Part 2
public class Product {
public static final BigDecimal DISCOUNT_RATE = BigDecimal.valueOf(0.1);
public BigDecimal getDiscount(){
return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP);
}
…
}
public class Shop {
public static void main(String[] args) {
Product p1 = new Product();
p1.setId(1);
p1.setName("Tea");
p1.setPrice(BigDecimal.valueOf(1.8));
System.out.println(p1.getId()+" , "+p1.getName()+"
, "+p1.getPrice()+" , "+ p1.getDiscount());
}
}
Java Source Code
1 , Tea , 1.8 , 0.18
Practices 03 – Object Classe : Part 2
public class Shop {
public static void main(String[] args) {
Product p1 = new Product();
//p1.setId(1);
//p1.setName("Tea");
p1.setPrice(BigDecimal.valueOf(1.8));
System.out.println(p1.getId()+" , "+p1.getName()+" ,
"+p1.getPrice()+" , "+ p1.getDiscount());
}
}
public class Shop {
public static void main(String[] args) {
Product p1 = new Product();
//p1.setId(1);
//p1.setName("Tea");
//p1.setPrice(BigDecimal.valueOf(1.8));
System.out.println(p1.getId()+" , "+p1.getName()+"
, "+p1.getPrice()+" , "+ p1.getDiscount());
}
}
Java Source Code
0 , null , 1.8 , 0.18
Exception in thread "main" java.lang.NullPointerException: Cannot
invoke "java.math.BigDecimal.multiply(java.math.BigDecimal)"
because "this.price" is null
at labs.pm.data.Product.getDiscount(Product.java:37)
at labs.pm.app.Shop.main(Shop.java:13)
public BigDecimal getDiscount(){
return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP);
}
Practices 03 – Object Classe : Part 3 : JavaDoc
/*
* Since: septembre 2023
* Author: mohamedyoussfi
* Name: Product.java
* Description:
*
* Copyright 2023 Gerald Venzl
*
* Licensed under the Oracle License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.oracle.com/
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package labs.pm.app;
import labs.pm.data.Product;
import java.math.BigDecimal;
/**
* {@code Shop} class represent an application that manage Products
* @version 4.0
* @author Oracle
*/
public class Shop {
public static void main(String[] args) {
Product p1 = new Product();
//p1.setId(1);
//p1.setName("Tea");
p1.setPrice(BigDecimal.valueOf(1.8));
System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice()+" , "+ p1.getDiscount());
}
}
Java Source Code
/**
* {@code Product} class represents properties and behaviours of
* product objects int the product management system
* <br>
* each product have an id, name and price
* <br>
* each product have discount, calculated based on :
* {@link DISCOUNT_RATE discount rate}
* @version 4.0
* @author Oracle
**/
public class Product {
/**
* Constant that defines a
* {@link java.math.BigDecimal BigDecimal} value of the discount rate
* <br>
* Discount rate is 10%
*/
public static final BigDecimal DISCOUNT_RATE = BigDecimal.valueOf(0.1);
/**
* Calculate Discount based on product price and
* {@link DISCOUNT_RATE discount rate}
* @return {@link java.math.BigDecimal BigDecimal}
* value of the discount
*/
public BigDecimal getDiscount(){
return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP);
}
Practices 03 – Object Classe : Part 3 : JavaDoc Java Source Code
Practices 03 – Object Classe : Part 3 : JavaDoc Java Source Code
file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
Practices 03 – Object Classe : Part 3 : JavaDoc Java Source Code
file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
Practices 03 – Object Classe : Part 3 : JavaDoc Java Source Code
file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
Practices 03 – Object Classe : Part 3 : JavaDoc Java Source Code
file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
Oracle Java 17 Developer Certification
Mohamed Youssfi, Enseignant Chercheur ENSET Mohammedia, Université Hassan II de Casablanca Consultant R&D Ingénierie Logicielle
Class, Object
Interfaces
Generics
Inheritance
Collections
Records
Arrays, Loops
Lambda Expressions Java Streams API
Exception Handling
Java IO API
Java Concurrency & Multi Threading
Modules
Annotations
JDBC API
Java Security
package labs.pm.data;
public enum Rating {
NOT_RATED("u2606u2606u2606u2606u2606"),
ONE_STAR("u2605u2606u2606u2606u2606"),
TWO_STAR("u2605u2605u2606u2606u2606"),
THREE_STAR("u2605u2605u2605u2606u2606"),
FOUR_STAR("u2605u2605u2605u2605u2606"),
FIVE_STAR("u2605u2605u2605u2605u2605");
private String stars;
Rating(String stars){
this.stars = stars;
}
public String getStars() {
return stars;
}
}
package labs.pm.data;
import java.math.BigDecimal;
import java.math.RoundingMode;
public class Product {
private int id;
private String name;
private BigDecimal price;
private Rating rating;
public static final BigDecimal DISCOUNT_RATE = BigDecimal.valueOf(0.1);
public Product(int id, String name, BigDecimal price, Rating rating) {
this.id = id;
this.name = name;
this.price = price;
this.rating = rating;
}
public Product(int id, String name, BigDecimal price) {
this(id,name,price, Rating.NOT_RATED);
}
public BigDecimal getDiscount(){
return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP);
}
// Getters only
}
Practice for Lesson 5 (5.1)
package labs.pm.app;
import labs.pm.data.Product;
import labs.pm.data.Rating;
import java.math.BigDecimal;
public class Shop {
public static void main(String[] args) {
//Product p1 = new Product();
Product p1 = new Product(101, "Tea", BigDecimal.valueOf(1.99));
Product p2 = new Product(102, "Coffee", BigDecimal.valueOf(1.88), Rating.THREE_STAR);
Product p3 = new Product(103, "Cake", BigDecimal.valueOf(1.12), Rating.TWO_STAR);
System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice()
+" , "+ p1.getDiscount()+ " , "+ p1.getRating().getStars());
System.out.println(p2.getId()+" , "+p2.getName()+" , "+p2.getPrice()
+" , "+ p2.getDiscount()+ " , "+ p2.getRating().getStars());
System.out.println(p3.getId()+" , "+p3.getName()+" , "+p3.getPrice()
+" , "+ p3.getDiscount()+ " , "+ p3.getRating().getStars());
}
} 101 , Tea , 1.99 , 0.20 , ☆☆☆☆☆
102 , Coffee , 1.88 , 0.19 , ★★★☆☆
103 , Cake , 1.12 , 0.11 , ★★☆☆☆
Practice for Lesson 5 (5.1)
package labs.pm.app;
import labs.pm.data.Product;
import labs.pm.data.Rating;
import java.math.BigDecimal;
public class Shop {
public static void main(String[] args) {
…..
Product p4 = new Product();
System.out.println(p4.getId()+" , "+p4.getName()+" , "+p4.getPrice()
+" , "+ p4.getDiscount()+ " , "+ p4.getRating().getStars());
…..
}
}
Exception in thread "main" java.lang.IllegalArgumentException: unknown format type: value
at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1551)
at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:492)
at java.base/java.text.MessageFormat.<init>(MessageFormat.java:371)
at org.example.Main.main(Main.java:11)
public Product() { }
Add Default Constructor de Product class
public Product() {
this(0, "no name", BigDecimal.ZERO);
}
Then modify the default constructor
101 , Tea , 1.99 , 0.20 , ☆☆☆☆☆
102 , Coffee , 1.88 , 0.19 , ★★★☆☆
103 , Cake , 1.12 , 0.11 , ★★☆☆☆
0 , no name , 0 , 0.00 , ☆☆☆☆☆
Practice for Lesson 5 (5.2)
public Product applyRating(Rating newRating){
return new Product(id, name, price, newRating);
}
Practice for Lesson 5 (5.3)
Product p5 = p3.applyRating(Rating.FOUR_STAR);
p2 = p2.applyRating(Rating.FIVE_STAR);
System.out.println(p5.getId()+" , "+p1.getName()+" , "+p1.getPrice()
+" , "+ p1.getDiscount()+ " , "+ p1.getRating().getStars());
System.out.println(p2.getId()+" , "+p2.getName()+" , "+p2.getPrice()
+" , "+ p2.getDiscount()+ " , "+ p2.getRating().getStars());
101 , Tea , 1.99 , 0.20 , ☆☆☆☆☆
102 , Coffee , 1.88 , 0.19 , ★★★☆☆
103 , Cake , 1.12 , 0.11 , ★★☆☆☆
0 , no name , 0 , 0.00 , ☆☆☆☆☆
103 , Tea , 1.99 , 0.20 , ☆☆☆☆☆
102 , Coffee , 1.88 , 0.19 , ★★★★★
Product class
Shop class

Part 2-Support Java 17 Certif Pr Youssfi V2.pdf

  • 1.
    Oracle Java 17Developer Certification Mohamed Youssfi, Enseignant Chercheur ENSET Mohammedia, Université Hassan II de Casablanca Consultant R&D Ingénierie Logicielle Class, Object Interfaces Generics Inheritance Collections Records Arrays, Loops Lambda Expressions Java Streams API Exception Handling Java IO API Java Concurrency & Multi Threading Modules Annotations JDBC API Java Security
  • 21.
  • 22.
  • 23.
    Create New Package: labs.pm.app. And Move the Shop class to this package
  • 24.
    Create a FileHeader Content for All Java Files
  • 25.
    Create A NewCopyright for this Project : The name of the copyright is : Oracle
  • 26.
    Insert thencontent ofthe copy right Since: $today.format("MMMM") $today.year Author: $username Name: $file.fileName Description: Copyright $today.year Gerald Venzl Licensed under the Oracle License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.oracle.com/ Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Copyright Example
  • 27.
    Assign the copyrightthe this project
  • 28.
    Create New JavaClass : Product in a specific package
  • 29.
    Practices 03 –Object Classe : Part 1 package labs.pm.data; import java.math.BigDecimal; /** * @author mohamedyoussfi **/ public class Product { private int id; private String name; private BigDecimal price; public int getId() { return id; } public void setId(int id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public BigDecimal getPrice() { return price; } public void setPrice(BigDecimal price) { this.price = price; } } package labs.pm.app; import labs.pm.data.Product; import java.math.BigDecimal; public class Shop { public static void main(String[] args) { Product p1 = new Product(); p1.setId(1); p1.setName("Tea"); p1.setPrice(BigDecimal.valueOf(1.8)); System.out.println(p1.getId()+" "+p1.getName()+" "+p1.getPrice()); } } 1 Tea 1.8 Java Source Code
  • 30.
    Practices 03 –Object Classe : Part 2 public void setPrice(BigDecimal price) { price = BigDecimal.ONE; this.price = price; } package labs.pm.app; import labs.pm.data.Product; import java.math.BigDecimal; public class Shop { public static void main(String[] args) { Product p1 = new Product(); p1.setId(1); p1.setName("Tea"); p1.setPrice(BigDecimal.valueOf(1.8)); System.out.println(p1.getId()+" "+p1.getName()+" "+p1.getPrice()); } } 1 Tea 1 Java Source Code public void setPrice(final BigDecimal price) { //price = BigDecimal.ONE; this.price = price; } 1 Tea 1.8
  • 31.
    Practices 03 –Object Classe : Part 2 public class Product { public static final BigDecimal DISCOUNT_RATE = BigDecimal.valueOf(0.1); public BigDecimal getDiscount(){ return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP); } … } public class Shop { public static void main(String[] args) { Product p1 = new Product(); p1.setId(1); p1.setName("Tea"); p1.setPrice(BigDecimal.valueOf(1.8)); System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice()+" , "+ p1.getDiscount()); } } Java Source Code 1 , Tea , 1.8 , 0.18
  • 32.
    Practices 03 –Object Classe : Part 2 public class Shop { public static void main(String[] args) { Product p1 = new Product(); //p1.setId(1); //p1.setName("Tea"); p1.setPrice(BigDecimal.valueOf(1.8)); System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice()+" , "+ p1.getDiscount()); } } public class Shop { public static void main(String[] args) { Product p1 = new Product(); //p1.setId(1); //p1.setName("Tea"); //p1.setPrice(BigDecimal.valueOf(1.8)); System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice()+" , "+ p1.getDiscount()); } } Java Source Code 0 , null , 1.8 , 0.18 Exception in thread "main" java.lang.NullPointerException: Cannot invoke "java.math.BigDecimal.multiply(java.math.BigDecimal)" because "this.price" is null at labs.pm.data.Product.getDiscount(Product.java:37) at labs.pm.app.Shop.main(Shop.java:13) public BigDecimal getDiscount(){ return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP); }
  • 33.
    Practices 03 –Object Classe : Part 3 : JavaDoc /* * Since: septembre 2023 * Author: mohamedyoussfi * Name: Product.java * Description: * * Copyright 2023 Gerald Venzl * * Licensed under the Oracle License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.oracle.com/ * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package labs.pm.app; import labs.pm.data.Product; import java.math.BigDecimal; /** * {@code Shop} class represent an application that manage Products * @version 4.0 * @author Oracle */ public class Shop { public static void main(String[] args) { Product p1 = new Product(); //p1.setId(1); //p1.setName("Tea"); p1.setPrice(BigDecimal.valueOf(1.8)); System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice()+" , "+ p1.getDiscount()); } } Java Source Code /** * {@code Product} class represents properties and behaviours of * product objects int the product management system * <br> * each product have an id, name and price * <br> * each product have discount, calculated based on : * {@link DISCOUNT_RATE discount rate} * @version 4.0 * @author Oracle **/ public class Product { /** * Constant that defines a * {@link java.math.BigDecimal BigDecimal} value of the discount rate * <br> * Discount rate is 10% */ public static final BigDecimal DISCOUNT_RATE = BigDecimal.valueOf(0.1); /** * Calculate Discount based on product price and * {@link DISCOUNT_RATE discount rate} * @return {@link java.math.BigDecimal BigDecimal} * value of the discount */ public BigDecimal getDiscount(){ return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP); }
  • 34.
    Practices 03 –Object Classe : Part 3 : JavaDoc Java Source Code
  • 35.
    Practices 03 –Object Classe : Part 3 : JavaDoc Java Source Code file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
  • 36.
    Practices 03 –Object Classe : Part 3 : JavaDoc Java Source Code file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
  • 37.
    Practices 03 –Object Classe : Part 3 : JavaDoc Java Source Code file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
  • 38.
    Practices 03 –Object Classe : Part 3 : JavaDoc Java Source Code file:///Users/mohamedyoussfi/IdeaProjects/enset/ProdManagement/out/index.html
  • 39.
    Oracle Java 17Developer Certification Mohamed Youssfi, Enseignant Chercheur ENSET Mohammedia, Université Hassan II de Casablanca Consultant R&D Ingénierie Logicielle Class, Object Interfaces Generics Inheritance Collections Records Arrays, Loops Lambda Expressions Java Streams API Exception Handling Java IO API Java Concurrency & Multi Threading Modules Annotations JDBC API Java Security
  • 57.
    package labs.pm.data; public enumRating { NOT_RATED("u2606u2606u2606u2606u2606"), ONE_STAR("u2605u2606u2606u2606u2606"), TWO_STAR("u2605u2605u2606u2606u2606"), THREE_STAR("u2605u2605u2605u2606u2606"), FOUR_STAR("u2605u2605u2605u2605u2606"), FIVE_STAR("u2605u2605u2605u2605u2605"); private String stars; Rating(String stars){ this.stars = stars; } public String getStars() { return stars; } } package labs.pm.data; import java.math.BigDecimal; import java.math.RoundingMode; public class Product { private int id; private String name; private BigDecimal price; private Rating rating; public static final BigDecimal DISCOUNT_RATE = BigDecimal.valueOf(0.1); public Product(int id, String name, BigDecimal price, Rating rating) { this.id = id; this.name = name; this.price = price; this.rating = rating; } public Product(int id, String name, BigDecimal price) { this(id,name,price, Rating.NOT_RATED); } public BigDecimal getDiscount(){ return price.multiply(DISCOUNT_RATE).setScale(2, RoundingMode.HALF_UP); } // Getters only } Practice for Lesson 5 (5.1)
  • 58.
    package labs.pm.app; import labs.pm.data.Product; importlabs.pm.data.Rating; import java.math.BigDecimal; public class Shop { public static void main(String[] args) { //Product p1 = new Product(); Product p1 = new Product(101, "Tea", BigDecimal.valueOf(1.99)); Product p2 = new Product(102, "Coffee", BigDecimal.valueOf(1.88), Rating.THREE_STAR); Product p3 = new Product(103, "Cake", BigDecimal.valueOf(1.12), Rating.TWO_STAR); System.out.println(p1.getId()+" , "+p1.getName()+" , "+p1.getPrice() +" , "+ p1.getDiscount()+ " , "+ p1.getRating().getStars()); System.out.println(p2.getId()+" , "+p2.getName()+" , "+p2.getPrice() +" , "+ p2.getDiscount()+ " , "+ p2.getRating().getStars()); System.out.println(p3.getId()+" , "+p3.getName()+" , "+p3.getPrice() +" , "+ p3.getDiscount()+ " , "+ p3.getRating().getStars()); } } 101 , Tea , 1.99 , 0.20 , ☆☆☆☆☆ 102 , Coffee , 1.88 , 0.19 , ★★★☆☆ 103 , Cake , 1.12 , 0.11 , ★★☆☆☆ Practice for Lesson 5 (5.1)
  • 59.
    package labs.pm.app; import labs.pm.data.Product; importlabs.pm.data.Rating; import java.math.BigDecimal; public class Shop { public static void main(String[] args) { ….. Product p4 = new Product(); System.out.println(p4.getId()+" , "+p4.getName()+" , "+p4.getPrice() +" , "+ p4.getDiscount()+ " , "+ p4.getRating().getStars()); ….. } } Exception in thread "main" java.lang.IllegalArgumentException: unknown format type: value at java.base/java.text.MessageFormat.makeFormat(MessageFormat.java:1551) at java.base/java.text.MessageFormat.applyPattern(MessageFormat.java:492) at java.base/java.text.MessageFormat.<init>(MessageFormat.java:371) at org.example.Main.main(Main.java:11) public Product() { } Add Default Constructor de Product class public Product() { this(0, "no name", BigDecimal.ZERO); } Then modify the default constructor 101 , Tea , 1.99 , 0.20 , ☆☆☆☆☆ 102 , Coffee , 1.88 , 0.19 , ★★★☆☆ 103 , Cake , 1.12 , 0.11 , ★★☆☆☆ 0 , no name , 0 , 0.00 , ☆☆☆☆☆ Practice for Lesson 5 (5.2)
  • 60.
    public Product applyRating(RatingnewRating){ return new Product(id, name, price, newRating); } Practice for Lesson 5 (5.3) Product p5 = p3.applyRating(Rating.FOUR_STAR); p2 = p2.applyRating(Rating.FIVE_STAR); System.out.println(p5.getId()+" , "+p1.getName()+" , "+p1.getPrice() +" , "+ p1.getDiscount()+ " , "+ p1.getRating().getStars()); System.out.println(p2.getId()+" , "+p2.getName()+" , "+p2.getPrice() +" , "+ p2.getDiscount()+ " , "+ p2.getRating().getStars()); 101 , Tea , 1.99 , 0.20 , ☆☆☆☆☆ 102 , Coffee , 1.88 , 0.19 , ★★★☆☆ 103 , Cake , 1.12 , 0.11 , ★★☆☆☆ 0 , no name , 0 , 0.00 , ☆☆☆☆☆ 103 , Tea , 1.99 , 0.20 , ☆☆☆☆☆ 102 , Coffee , 1.88 , 0.19 , ★★★★★ Product class Shop class