Guest User

Untitled

a guest
Jun 25th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1.  
  2. From: TA
  3. Sent: some date
  4. To: Spec
  5. Subject: Problem 2.14
  6.  
  7. Hi Spec,
  8.  
  9. 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.
  10.  
  11. Thanks,
  12. TA
  13. ---------------------------------------------------------------------------------
  14.  
  15. From: Spec
  16. Sent: some date
  17. To: TA; Spec
  18. Subject: Problem 2.14
  19.  
  20. Hello,
  21.  
  22. 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.
  23.  
  24. 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.
  25.  
  26. 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.
  27.  
  28. 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".
  29.  
  30. Please let me know if I need to take this to the professor.
  31.  
  32. Thanks,
  33.  
  34. -- Spec
  35.  
  36. ---------------------------------------------------------------------------------
  37.  
  38. From: TA
  39. Sent: some date
  40. To: Spec
  41. Subject: Problem 2.14
  42.  
  43. Hi Spec,
  44.  
  45. 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.
  46. Also, the question says to print 1-4 numbers , so you need to print all 4 with each of the print statements.
  47. It would be like System.out.println("1 2 3 4"); and so on.
  48.  
  49. If you would like the whole solution, I cannot provide you with it you need to contact professor for the solution.
  50.  
  51. Thanks,
  52. TA
  53.  
  54. ---------------------------------------------------------------------------------
  55.  
  56. From: Spec
  57. Sent: some date
  58. Subject: Problem 2.14
  59.  
  60. Hello TA,
  61.  
  62. For question 2.14 I got the comment:
  63.  
  64. "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."
  65.  
  66. However, the question reads:
  67.  
  68. """
  69. 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:
  70. a.) Use one System.out.println statement.
  71. b.) Use four System.out.print statements.
  72. c.) Use one System.out.printf statement.
  73. """
  74.  
  75. 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.
  76.  
  77. 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.
  78.  
  79. As for not understanding the question ... my java code shows I understood it perfectly well.
  80.  
  81.  
  82. Thanks,
  83.  
  84. -- Spec
  85.  
  86.  
  87. PS: If still I lose points for this, please provide to me the correct pseudocode for this problem.
  88.  
  89. ---------------------------------------------------------------------------------
  90.  
  91. Java code I provided:
  92.  
  93. // Name: PrintNumbers.java
  94. // Author: Spec
  95. // Date: some date
  96. // Purpose: [Problem 2.14] To print the numbers 1 through 4,
  97. // with adjacent numbers being separated
  98. // by a space.
  99. // Constraints: Must use one System.out.println, 4 System.out.print, and
  100. // one System.out.printf statement.
  101.  
  102. // PrintNumbers class definition
  103. public class PrintNumbers
  104. {
  105. // main method is start point of execution
  106. public static void main( String[] args )
  107. {
  108. // prints the numbers under the constraints required
  109. System.out.print( "1" );
  110. System.out.print( " " );
  111. System.out.print( "2" );
  112. System.out.print( " " );
  113. System.out.printf( "%d ", 3 );
  114. System.out.println( "4" );
  115. } // end main definition
  116. } // end class definition
Add Comment
Please, Sign In to add comment