Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help in completing this assignment, if you follow each task it will help

ID: 3786375 • Letter: I

Question

I need help in completing this assignment, if you follow each task it will help to complete it

Task 1 In order to use variables in Java they must first be declared and initialized. First we will look at primitive data types The syntax for declaration is this: int number; String greeting To give it value, use the assignment operator number 25 greeting Hello You can also declare and initialize in the same line: int number 25 String greeting Hello In the area indicated, declare and initialize: 1. A String called name and value "Luis" 2. A second String called answer with "Good day" 3. An int with name piecount and value 16 Note: When assigning Strings it is necessary to have the double quotes around the characters to be stored. Also note the information stored is really an address in memory, and not the characters in the double quotes. This will be covered in further detail in a later lesson. When the program is run, the output should be: As runner 16 passed you, Luis said Good day

Explanation / Answer

import java.util.Scanner;

public class Lab1d

{

public static void main(String[] args)

{

int pieCount = 16;

string name,answer;

name = "Luis";

answer ="Good Day";

Scanner scan = new Scanner(System.in);

System.out.println("As runner" + pieCount + "passed you, " + name + "said" + answer);

System.out.println("you see a girl, What is her name?");

name = scan.nextLine();

System.out.println("Does she want a pie?");

answer= scan.nextLine();

System.out.println(" How many pies do you have?);

scan.nextInt();

System.out.printlnln();

System.out.print("you met" + name +" while walking down the street.");

System.out.print("when asked if she wanted pie, she replied" + answer + "");

system.out.println("you currently have " + pieCount + " so you decide to give her one ");

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote