ITEC 1620 Study Guide - Final Guide: Negative Number, Felix Unger

388 views4 pages

Document Summary

Itec 1620 assignment three: what output is produced by the following code fragment? int limit = 100, num1 = 15, num2 = 40; if (limit <= limit){ if (num1 == num2) Answer: the output is lime grape: pp 5. 9 modify the die class from chapter 4 so that the setfacevalue method does nothing if the parameter is outside of the valid range of values. // represents one die (singular of dice) with faces showing values. // between 1 and 6. public class die2 private final int max = 6; // maximum face value private int facevalue; // current value showing on the die. // constructor: sets the initial face value. public die2(){ facevalue = 1; // rolls the die and returns the result. public int roll(){ facevalue = (int) (math. random() * max) + 1; return facevalue; Does nothing if the value is not valid. public void setfacevalue(int value){ if (value >= 1 && value <= max) facevalue = value;

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers