[Solved] : CS 140 Introduction to Computer Science Lab #2

30 $

File Name: :_CS_140_Introduction_to_Computer_Science_Lab_#2.zip
File Size: 452.16 KB

SKU: [Solved] : CS 140 Introduction to Computer Science Lab #2 Category: Tag:

Or Upload Your Assignment Here:


CS 140 Introduction to Computer Science Lab #2

For this lab, students will work individually. If questions arise, try to see if those around you are able to answer them, chances are one of your fellow students has encountered your problem and has figured out how to solve it. Ask the instructor for help as a last resort.Try your best to complete the following programs today in class. If you cannot complete them all, make sure you complete them prior to the next class. Submit all files together in one .zip file to blackboard.

FormattedOutput.javaKeyboardInput.javaVendingMachine.javaStringMethods.javaIsEven.java

Lab Objectives Be able to create Java programs witho Variables, Constantso Primitive data typeso Stringso Keyboard input and outputo Decision Structureso Input Validation Be able to compile and execute a Java program Be able to test and debug a program

Task #1 Formatted OutputWrite a program using escape sequences to print out the following: your name, your major, and your study list. The output should look exactly like this:Student: “Superior Diaz” Major: Computer Science Study List: CS ‘130’, ‘140’, and MAT ‘115’Task #2 Keyboard InputWrite a program that will ask the user to enter the following information in the given order: Name (String) Age (int) Company Name (String)Your Program should display the following message using println.My name is Superior Diaz, my age is 26 andI hope to work for Skynet.

Task #3 Vending MachineWrite a program that determines the change to be dispensed from a vending machine. An item in the machine can cost between 25 cents and a dollar, in 5-cent increments (25, 30, 35, … 90, 95, 100), and the machine accepts only a single dollar bill to pay for the item. For example, a possible sample dialog might beEnter price of item (from 25 cents to a dollar, in 5-cent increments): 45You bought an item for 45 cents and gave me a dollar, So your change is 2 quarters, 0 dimes, and 1 nickels.

Task #4 Is EvenRewrite the following program, add statements to verify whether the user input is either odd or even and make sure its within the range given, otherwise return an error.//analysis of numbersimport java.util.Scanner;public class IsEven {public static void main(String[] args){boolean evenOdd=false;Scanner keyboard = new Scanner(System.in);System.out.println(“Enter an integer from 0-10: “);int n = keyboard.nextInt();System.out.println(“Is that number even? “+evenOdd);}}Task #5 String Methods (Challenge)Write a program that asks the user to enter your info, and it displays a story about you in a special format. The program should ask you to enter (use the Scanner class) the following: – first name – middle name – last name – age – lucky number – favorite colorFor example, a possible sample dialog might bePlease enter your first name: superior Please enter your middle name: SPIDER Please enter your last name: mAn Please enter your age: 20 Please enter your lucky number: 9 Please enter your favorite color: GrEeNA story about Superior Spider Man:SUPERIOR SPIDER MAN is SSM.SSM’s favorite color is green, and Superior M. is 20.The lucky number of Superior S. Man is 9.

Reviews

There are no reviews yet.

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

Shopping Cart
[Solved] : CS 140 Introduction to Computer Science Lab #2
30 $