Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From: TA
- Sent: some date
- To: Spec
- Subject: Problem 2.14
- Hi Spec,
- This is my interpretation of the question. I think you can talk to the professor and if she asks me to update your grades I will do so.
- Thanks,
- TA
- ---------------------------------------------------------------------------------
- From: Spec
- Sent: some date
- To: TA; Spec
- Subject: Problem 2.14
- Hello,
- The question actually says, and I quote, "...that displays the numbers 1 to 4 on the same line". That means, "the numbers 1 to 4"...not any 4 numbers. It clearly states "THE NUMBERS 1 to 4", as in, "1 2 3 4". I feel like this question isn't really open to interpretation, as it clearly dictates the requirements.
- Further, it doesn't say to print "all 4 numbers" with each of the print statements. It says, and I quote, "...that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space." It then dictates how this should be accomplished -- with one println statement, one print statement, and one printf statement. Nowhere does that instruction indicate more than one line should be printed, or that it should accept any input.
- I would argue if a program was written that accepted any input, or printed multiple lines, it would not be an acceptable solution to this problem.
- As you can see with my Java code, I use all six required statements (one println, four print, and one printf) to accomplish the stated goal -- "...displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space".
- Please let me know if I need to take this to the professor.
- Thanks,
- -- Spec
- ---------------------------------------------------------------------------------
- From: TA
- Sent: some date
- To: Spec
- Subject: Problem 2.14
- Hi Spec,
- First, the question says you need to print 1-4 numbers using the 3 print statements. I wrote any 4 numbers for the desk check. You can input any other 4 numbers too for just the desk check.
- Also, the question says to print 1-4 numbers , so you need to print all 4 with each of the print statements.
- It would be like System.out.println("1 2 3 4"); and so on.
- If you would like the whole solution, I cannot provide you with it you need to contact professor for the solution.
- Thanks,
- TA
- ---------------------------------------------------------------------------------
- From: Spec
- Sent: some date
- Subject: Problem 2.14
- Hello TA,
- For question 2.14 I got the comment:
- "2.14: Input is 4 numbers. Data set would be any 4 numbers. Output all the 4 numbers has to be displayed using three different print statements. Understanding of question is wrong."
- However, the question reads:
- """
- Write an application that displays the numbers 1 to 4 on the same line, with each pair of adjacent numbers separated by one space. Write the program using the following techniques:
- a.) Use one System.out.println statement.
- b.) Use four System.out.print statements.
- c.) Use one System.out.printf statement.
- """
- It says "displays the numbers 1 to 4"...that's clearly not any 4 numbers, as well it is not input, those are literals in this context. It's always going to be the numbers 1-4, and they're literal strings -- that's not input. For an example of why it's not input, please see the java code.
- As for why I left the processing blank, the processing steps as we are taught are the steps used to solve the problem -- that is the application. The individual language-specific steps are not represented in the processing area, and with this problem, no "processing" is done. The output is simply displayed (output). I believe the java-language-specific-constraints on this problem have no bearing on the design definition, pseudocode/solution algorithm, or deskchecking the algorithm.
- As for not understanding the question ... my java code shows I understood it perfectly well.
- Thanks,
- -- Spec
- PS: If still I lose points for this, please provide to me the correct pseudocode for this problem.
- ---------------------------------------------------------------------------------
- Java code I provided:
- // Name: PrintNumbers.java
- // Author: Spec
- // Date: some date
- // Purpose: [Problem 2.14] To print the numbers 1 through 4,
- // with adjacent numbers being separated
- // by a space.
- // Constraints: Must use one System.out.println, 4 System.out.print, and
- // one System.out.printf statement.
- // PrintNumbers class definition
- public class PrintNumbers
- {
- // main method is start point of execution
- public static void main( String[] args )
- {
- // prints the numbers under the constraints required
- System.out.print( "1" );
- System.out.print( " " );
- System.out.print( "2" );
- System.out.print( " " );
- System.out.printf( "%d ", 3 );
- System.out.println( "4" );
- } // end main definition
- } // end class definition
Add Comment
Please, Sign In to add comment