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...
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)...
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 can you make it simple. For example using scanner or hard coding when it is...
please can you make it simple. For example using scanner or hard coding when it is a good idea instead of arrays and that stuff.Please just make one program (or class) and explain step by step. Also it was given to me a txt.htm 1.- Write a client program and a server program to implement the following simplified HTTP protocol based on TCP service. Please make sure your program supports multiple clients. The webpage file CS3700.htm is provided. You may...
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...
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...
For some reason I followed the steps in my project and I am getting the incorrect...
For some reason I followed the steps in my project and I am getting the incorrect output and when I am submitting it, it gives me compilation error. Printing empty array -- next line should be blank Testing append: Shouldn't crash! Should print 100 through 110 below, with 110 on a new line: 100 101 102 103 104 105 106 107 108 109 110 Checking capacity of new array: OK Append test #2: Should print 100 through 120 below, on...
Java : Modify the selection sort algorithm to sort an array of integers in descending order....
Java : Modify the selection sort algorithm to sort an array of integers in descending order. describe how the skills you have gained could be applied in the field. Please don't use an already answered solution from chegg. I've unfortunately had that happen at many occasion ....... ........ sec01/SelectionSortDemo.java import java.util.Arrays; /** This program demonstrates the selection sort algorithm by sorting an array that is filled with random numbers. */ public class SelectionSortDemo { public static void main(String[] args) {...
Please do the following in python: Write a program (twitter_sort.py) that merges and sorts two twitter...
Please do the following in python: Write a program (twitter_sort.py) that merges and sorts two twitter feeds. At a high level, your program is going to perform the following: Read in two files containing twitter feeds. Merge the twitter feeds in reverse chronological order (most recent first). Write the merged feeds to an output file. Provide some basic summary information about the files. The names of the files will be passed in to your program via command line arguments. Use...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT