CSE 110 – Lab 5 solution

$14.99

Original Work ?
Category: You will Instantly receive a download link for .ZIP solution file upon Payment

Description

5/5 - (4 votes)

This lab is for practicing the nested for loops and switch statement. Use the following Coding Guidelines: • When declaring a variable, you usually want to initialize it. • Use white space to make your program more readable. • Use comments after the ending brace of classes, methods, and blocks to identify to which block it belongs. Assignments Documentation: At the beginning of each programming assignment you must have a comment block with the following information: / *————————————————————————-// AUTHOR: (Put your name here) // FILENAME: Lab6.java // SPECIFICATION: This program is for practicing nested loops. // It prints out a certain size of pyramid and triangle of stars // INSTRUCTIONS: Read the following code skeleton and add your own code // according to the comments. Ask your TA or your class// mates for help and/or clarification. When you see // //– that is where you need to add code. // LAB LETTER: (Put your lab letter) //————————————————————————*/Getting Started Create a class called Lab6. Use the same setup for setting up your class and main method as you did for the previous assignments. Be sure to name your file Lab6.java. Hints Please replace //– with the correct program to finish the task according to the corresponding comment. Please replace ??? with the correct program to enable the program to run as required. / *————————————————————————-// AUTHOR: (Put your name here) // FILENAME: Lab6.java // SPECIFICATION: This program is for practicing nested loops. // It prints out a certain size of pyramid and triangle of stars // INSTRUCTIONS: Read the following code skeleton and add your own code // according to the comments. Ask your TA or your class// mates for help and/or clarification. When you see // //– that is where you need to add code. // LAB LETTER: (Put your lab letter) //————————————————————————*/
//import Scanner class import java.util.Scanner; //declare the class Lab6 public class Lab5 { //declare the main method public static void main(String[] args) { // Declare Constant integers PYRAMID = 1, TRIANGLE = 2, QUIT = 3 final int PYRAMID = 1; final int TRIANGLE = 2; final int QUIT = 3;
// Define scan object of the type Scanner class //– // Create an integer variable named choice. //— //define an int variable