Question: Using java language! Answer the following questions depends on the class attached The class is: Add an exception for checking if RGB values are outside


Add an exception for checking if RGB values are outside [0,255). Add an exception for checking if the sides of a triangle are valid. Practice throwing and handling the exceptions. class RGB private int R, G,B; public RGB this(@,0,); public RGB(int R, int G, int B) this. R=R; this.G=G; this.BB; public int[] getColor() return new int[]{R,G,B); public void setColor(int[] c) REC[0]; G=C[1]; BEC [2]; public String toString() return "("+R+","+G+","+B+")"; public boolean equals(RGB r) int[] cer.getColor(); return (this. R==c[@]) && (this.Gauc[1]) && (this. Bauc[2]); public RGB invert() return new RGB (255-R, 255-G, 255-B)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
