fork download
  1. importPackage(java.io);
  2. importPackage(java.lang);
  3.  
  4. {
  5. // Put your solution to Exercise #4 here.
  6.  
  7. var color1 = prompt("Enter primary color: ")
  8. var color2 = prompt("Enter primary color: ")
  9.  
  10.  
  11. if (color1 == "red" && color2 == "blue")
  12. {
  13. console.log("When you mix red and blue, you get purple.");
  14. }
  15.  
  16. else if (color1 == "blue" && color2 == "red")
  17. {
  18. console.log("When you mix blue and red, you get purple.");
  19. }
  20.  
  21. else if (color1 == "yellow" && color2 == "red")
  22. {
  23. console.log("When you mix yellow and red, you get green.");
  24. }
  25.  
  26. else if (color1 == "red" && color2 == "yellow")
  27. {
  28. console.log("When you mix red and yellow, you get green.");
  29. }
  30.  
  31. else if (color1 == "blue" && color2 == "yellow")
  32. {
  33. console.log("When you mix blue and yellow, you get purple.");
  34. }
  35.  
  36. else if (color1 == "yellow" && color2 == "blue")
  37. {
  38. console.log("When you mix yellow and blue, you get purple.");
  39. }
  40.  
  41.  
  42. else
  43. {
  44.  
  45. console.log("Error");
  46.  
  47. }
  48. }
  49.  
  50.  
  51.  
  52.  
  53.  
Runtime error #stdin #stdout #stderr 0.29s 39336KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
js: uncaught JavaScript runtime exception: ReferenceError: "prompt" is not defined.