Question

I am currently having an issue with coding Java through MyProgrammingLab. This is the question: Write...

I am currently having an issue with coding Java through MyProgrammingLab.

This is the question: Write a single statement that will print the message "first is " followed by the value of first, and then a space, followed by "second = ", followed by the value of second. Print everything on one line and go to a new line after printing. Assume that first has already been declared as a double and that second has been declared as an int. Assume also that the variables have already been given values.

So far, this is my answer:

System.out.println("first is " + first + " first.");
System.out.println("");
System.out.println("second = " + second + " second.");

Whenever I submit, the only error it gives me is:

⇒ Correct solutions that use "second = " almost certainly also uses " "

Whatever that means... I feel like I am missing something so simple, could anybody help me here?

Homework Answers

Answer #1

This question has below main parts: -

1. We first need to print "first is" then value, then space and then "second is" and then value of second.

2. Complete answer should be of one line.

3. After the answer it should move to next line.

Now println() function prints everything on one line and move to next line after printing it so we can use this function.

Your correct answer will be: -

System.out.println("first is "+first+" "+"second = "+second);

In this way you can print the complete answer in one line.

Above statement can also be written as: -

System.out.println("first is "+first+" second = "+second);

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
I am having some trouble visualizing this present value question and have already put it on...
I am having some trouble visualizing this present value question and have already put it on a timeline, but it's still not clear. I think I may be making it more complex than it really is, but here is the question and then I will explain why I am having problems. At an annual interest rate of 6%, which would you prefer - three annual year-end cash flows of $250 each with the first cash flow one year from today...
I am having a difficult time understanding what my professor is looking for in this research...
I am having a difficult time understanding what my professor is looking for in this research paper and he told me to reread his outline... I am at a loss of how to structure my research paper and would appreciate some quidence. Class: Healthcare Informatics Research paper topic: Information technology in public health disaster emergencies. Outline: -Your task is to produce a review of published literature (at least 70% of sources to be refereed journal papers, the rest can be...
Here is the code I am supposed to Analyze: // If we want to use the...
Here is the code I am supposed to Analyze: // If we want to use the Scanner class (type) to get user input, we need // to import the following Java package that includes the Scanner class // definitions. We do not have to add an import statement to use the // print() or println() methods of the System object, because they // are built in. import java.util.Scanner; public class PRG420Week1_AnalyzeAssignment { /* The main() method you see below is...
4) Write a java program where you will use while loop, where if condition is equal...
4) Write a java program where you will use while loop, where if condition is equal to 2 (or any other choice of your number) then it will break the while condition. Steps: 1) Declare variable int (any name) which is equal to zero 2) Declare while condition which variable int is less then equal to 10 3) Declare print out where the value of variable is the same name that you declared in step 1 4) Declare condition if...
I am having a problem with this one error. I have to turn this in tonight...
I am having a problem with this one error. I have to turn this in tonight and this is holding me up right now. Just not sure how to fix it. .VS 2019 .net framework windows forms private void DisplayForm_Load(object sender, EventArgs e) { if (File.Exists("Employee.txt")) { using (StreamWriter sr = new StreamWriter("employee.txt")) { string employeeId = ""; while ((employeeId = sr.ReadLine()) != null) { Employee employee = new Employee(employeeId, sr.ReadLine(), decimal.Parse(sr.ReadLine()), decimal.Parse(sr.ReadLine())); Employee emp = employee; employeeListBox.Items.Add(emp); allEmployee.Add(emp); }...
Currently stuck on this part of a project. I am struggling with creating the String for...
Currently stuck on this part of a project. I am struggling with creating the String for creating the dice values in the boxes for the "showDice" string. I have already completed the first part which was creating the class for the Die. This is Javascript. For this part, we will create the class that allows you to roll and score the dice used in a game of Yahtzee. This will be the longest part of the project, so I suggest...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import...
please write the code in java so it can run on jGRASP import java.util.Scanner; 2 import java.io.*; //This imports input and output (io) classes that we use 3 //to read and write to files. The * is the wildcard that will 4 //make all of the io classes available if I need them 5 //It saves me from having to import each io class separately. 6 /** 7 This program reads numbers from a file, calculates the 8 mean (average)...
Possible Duplicate: What experiments prove the greenhouse effect? I am seeking for a proof that CO2...
Possible Duplicate: What experiments prove the greenhouse effect? I am seeking for a proof that CO2 is a greenhouse gas. I posted this on Skeptic.SE recently but found no help in seeking for proof: I assisted to a physicist conference in my university a few years ago against the case that carbon dioxide was a cause of global warming. The main point was that CO2 is not a greenhouse gas. I did a research to find evidence for either side...
Question about mixed solvents for recrystallization. I am having a hard time conceptualizing how a mixed...
Question about mixed solvents for recrystallization. I am having a hard time conceptualizing how a mixed solvent would work in a scenario where P and O nitronitroacetanilide are recrystallized with a small amount of hot Ethanol followed by a larger volume of water. From the structure of the molecules I assumed that the Para form of nitroacetanilide is more polar than the Ortho form. Second, I know that water>ethanol for polarity. Finally, I know that water and ethanol can hydrogen...
I did already posted this question before, I did get the answer but i am not...
I did already posted this question before, I did get the answer but i am not satisfied with the answer i did the code as a solution not the description as my solution, so i am reposting this question again. Please send me the code as my solution not the description In this project, build a simple Unix shell. The shell is the heart of the command-line interface, and thus is central to the Unix/C programming environment. Mastering use of...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT