CMYK - /** = String s truncated (if necessary) to its first...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
/** An instance represents a CMYK value */  public class CMYK {     /** Color cyan. 0  c 1. */     public double c;          /** Color magenta. 0 m 1. */     public double m;          /** Color yellow. 0 y 1. */     public double y;          /** Color black. 0 c 1. */     public double k;          /** Constructor: the CMYK value (c, m, y, k).         Precondition: All components c, m, y, and k are           0 and  1.*/     public CMYK(double c, double m, double y, double k) {         this.c= c;         this.m= m;         this.y= y;         this.k= k;     } 
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: /** = String s truncated (if necessary) to its first 5 characters. */ public static String truncate(String s) { if (s.length() <= 5) return s; return s.substring(0,5); } /** = string representation of this instance */ public String toString() { return "(" + truncate("" + c) + ", " + truncate("" + m) + ", " + truncate("" + y) + ", " + truncate("" + k) + ")"; } }...
View Full Document

Page1 / 2

CMYK - /** = String s truncated (if necessary) to its first...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online