[Solved] CMSC255 901 Lab Questions Big Java, Late Objects / Java for Everyone, 2e Chapter Number: 1 Introduction

$25

File Name: CMSC255__901_Lab_Questions_Big_Java,_Late_Objects_/_Java_for_Everyone,_2e_Chapter_Number:_1_Introduction.zip
File Size: 979.68 KB

SKU: [Solved] CMSC255 – 901 Lab Questions Big Java, Late Objects / Java for Everyone, 2e Chapter Number: 1 Introduction Category: Tag:
5/5 - (1 vote)

1) Open a simple text editor and type in the following program:

public class HelloPrinter{public static void main(String[] args){System.out.println(Hello, World);}}

Open a console window and create an empty directory for your work. Save your work in a file called HelloPrinter.java. Pay attention to the case of letters in your program and in the name of the file. Compile your program from the console window by typing the following command:

javac HelloPrinter.java

What files are contained in the directory after you have compiled the program?Java program file and class file.

Run your program by typing the following command:

java HelloPrinter

What is the output of your program?

What is contained in the .class file?

When you have finished, try compiling and running the program from your IDE.

2) Its ok to make errors. In fact, the more errors you make, the quicker you will become an expert Java programmer. Each error can teach you an important lesson. So lets make a few errors by experimenting with the HelloPrinter program from Lab 1.1.a) Try deleting the only semicolon. What happens when you compile? Fix the error.

b) Try deleting the left brace under the main method and compiling your program. What happens? Fix the error.

c) Delete the first left brace in the program. What happens when you compile? Fix the program.

d) Change main to Main. Does the program compile? What happens if you run the program from the console window? What is the problem?

3) Imagine that its your job to count all the people attending a baseball game in Yankee Stadium and report the result to the stadium manager. There are many ways you could proceed. Pick one method and write your solution in pseudocode

4) Assume you are a bank manager and you want to teach the tellers in the bank how to count the paper currency in their teller drawers. Write pseudocode for a method of counting the money.

5) Imagine you have a box of rectangular blocks. Write some psuedocode that will instruct a person to stack twenty blocks into a rectangular array of four rows of five blocks as pictured below. Write the solution in a way that could be generalized easily to larger rectangles.

6) Imagine you have a box of rectangular blocks. Write some psuedocode that will instruct a person to stack fifteen blocks into the arrangement below. Write the solution in a way that can be generalized easily to larger arrangements.

7) Imagine you have a box of rectangular blocks. Write some psuedocode that will instruct a person to stack nine blocks into the arrangement below. Write the solution in a way that can be generalized easily to larger pyramids.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CMSC255 901 Lab Questions Big Java, Late Objects / Java for Everyone, 2e Chapter Number: 1 Introduction
$25