CSE 14 Study Guide - Midterm Guide: Instance Variable, Rational Number

112 views5 pages
15 Oct 2018
School
Course
Professor

Document Summary

Determine the output of the following program. public class question1{ public static void main(string[] args){ Car z = new car(blue, 150000); x = y; roadtrip(x); z = x; Car a = c; a. drive(); c. drive(); c. drive(); c. drive(); public class car{ Car(string color, int mileage){ this. color = color; this. mileage = mileagae; void drive(){ mileage++; Rational will consist of a numerator and a denominator both fields are private. Rational will also have a method called times() that will multiply itself by another rational number, and return the result as a rational number. It is not necessary to reduce fractions to lowest terms. Write a method insert() that accepts the following parameters: an array of integers a, an integer index n, and an integer to be inserted val. Determine the output of the following program. public class question4{ public static void main(string[] args){ System. out. println(d. id); public class driver{ int id; static int numdrivers = 0;

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

Related Documents

Related Questions