Question Two Follow the steps listed in Question One to create a program with th
ID: 3783805 • Letter: Q
Question
Question Two Follow the steps listed in Question One to create a program with the following skeleton: your name t Lab One, Question Two t public class LaboneQ2 (t public static void main (String args) t At the beginning of the main method declare variables for each of the following: A variable to contain a year. Avariable to contain the number of students in CS111- Avariable to contain a temperature A variable to contain the letter grade for a course A variable to contain an exam score A variable to contain the number of concert tickets ordered A variable to contain the current balance in a bank account. A variable to contain the name of a movie Insert code to set the variables as follows:Explanation / Answer
PROGRAM CODE:
package simple;
public class LabOneQ2 {
public static void main(String[] args) {
//Declaring variables
int year;
int numberOfStudents;
double temperature;
char grade;
double examScore;
int numberOfConcertTickets;
double currentBankBalance;
String movieName;
//Assigning value to variables
year = 2017;
numberOfStudents = 29;
temperature = 23.4;
grade = 'A';
examScore = 88.5;
numberOfConcertTickets = 3;
currentBankBalance = 20534.67;
movieName = "You've Got Mail";
//printing all the values
System.out.println("The year of my graduation is " + year);
System.out.println("The strength in my class is " + numberOfStudents);
System.out.println("The temperature outside is " + temperature + " degrees celsius");
System.out.println("I hope to get " + grade + " grade");
System.out.println("My exam score is " + examScore );
System.out.println("I have booked for " + numberOfConcertTickets + " concert tickets");
System.out.println("My current bank balance is " + currentBankBalance);
System.out.println("My favourite movie is " + movieName);
}
}
OUTPUT:
The year of my graduation is 2017
The strength in my class is 29
The temperature outside is 23.4 degrees celsius
I hope to get A grade
My exam score is 88.5
I have booked for 3 concert tickets
My current bank balance is 20534.67
My favourite movie is You've Got Mail
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.