Purchase Solution

Read and Understand Code

Not what you're looking for?

Ask Custom Question

Read and Understand Code
What is the length of the line being drawn?
g.drawLine (50, 20, 50, 350);
What is the (x, y) coordinate of the lower-right corner of the rectangle being drawn?
g.drawRect (10, 20, 250, 350);
_______________________________________________________________________________
Fill in the code
This code sets the current color to red
// assume you have a Graphics object named g
// code goes here
This code draws the string "Fill in the Code" with the lower-left corner of the first character (the f) being coordinate (100, 250).
// assume you have a graphics object called g
// code goes here
Identifying Errors in Code
Where is the error in this code sequence?
// we are inside method paint
g.drawString ('find the bug', 100, 200);
Where is the error in this code sequence?
// we are inside method paint
g.setColor(green);

Purchase this Solution

Solution Summary

The solution gives detailed guide to some coding questions. I provide both answers and explanations.

Solution Preview

What is the length of the line being drawn?
g.drawLine (50, 20, 50, 350);
ans: length=sqrt[(50-50)^2+(350-20)^2]=330

What is the (x, y) coordinate of the lower-right corner of the rectangle being drawn?
g.drawRect (10, 20, 250, 350);
ans: (x, y) coordinate = (10+250, 20-350) = (260, ...

Purchase this Solution


Free BrainMass Quizzes
Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Javscript Basics

Quiz on basics of javascript programming language.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.