Use the correct syntax of a common programming

Assignment Help JAVA Programming
Reference no: EM131091006

Overview

This assignment requires you to write a Java program to carry out a series of operations as specified below. The appendix at the back of the assignment specification provides an example of the output required from the final program.The tasks required of your program will require you to demonstrate your understanding of the programming concepts.

  • • Declaring variables; assigning and testing their values;
  • • Input and output
  • • Reading a Class API, and using objects and behaviours of that class
  • • Decision-making (if and switch statements)
  • • Loops (for loops, while and/or do..while loops, nested loops)

Learning Outcomes Assessed

The following course learning outcomes are assessed by completing this assessment:

  • • K1. identify and use the correct syntax of a common programming language;
  • • K2. recall and use typical programming constructs to design and implement simple software solutions;
  • • K3. reproduce and adapt commonly used basic algorithms;
  • • K4. explain the importance of programming style concepts (documentation, mnemonic names,indentation);
  • • S1. utilise pseudocode and/or algorithms as a major program design technique;
  • • S2. write and implement a solution algorithm using basic programming constructs;
  • • S3. demonstrate debugging and testing skills whilst writing code;
  • • S4. describe program functionality based on analysis of given program code
  • • A1. develop self-reliance and judgement in adapting algorithms to diverse contexts;
  • • A2. design and write program solutions to identified problems using accepted design construct

Assessment Details

Your program must carry out the following tasks, in this order:

• Draw 60 asterisks (*) on the screen followed by a new line character

o This should be accomplished using an appropriate loop construct

• Prompt the user to enter a date. This should be achieved by first entering a year, then a month, then a day within that month – these will all be entered as integer values.

o If the user enters a year earlier than 1900 or later than 2100 they should be asked to re-enter a valid year. This process should repeat until they enter a valid value.

o If the user enters a month less than 1 or greater than 12 they should be asked to re-enter a valid month. This process should repeat until they enter a valid value.

o If the user enters a day less than 1 or greater than the number of days in their chosen month,they should be asked to re-enter a valid day. This should repeat until they enter a valid day.

Note: You do not need to consider leap years – you can assume February always has 28 days.

o The sections of program output for year, month and day should be separated by displaying a line of 30 dashes (-) as shown in the sample output at the back of this document. Printing each of these lines should be accomplished using an appropriate loop construct

o You should be able to do this after we have covered while and do

• Once a valid date has been entered by the user you should compare this to the date 1st of March 2016,and print a message stating the outcome of this comparison (that the user’s entered date is before,after or equal to the 1st March 2016).

o You must do this using the java.util.Date class

o Start by reading the online API for java.util.Date, focusing on the constructors and the comparison methods.

You will notice that Date has been deprecated. This means it has been replaced by another class (in this case GregorianCalendar) and its use is no longer recommended.

However it is better suited to the purposes of this assignment, so ignore any warnings which the compiler generates regarding deprecation.

o Use the values entered by the user to instantiate a Date variable

  • Carefully read the API documentation to ensure you do this correctly

o Instantiate a second Date variable to represent 1st March 2016

o Use methods from the Date class along with an appropriate decision construct to compare the two Dates, and print out a message – the message should include both dates as formatted by the Date class’ toString() method (as shown in the sample output)

• Draw another 60 asterisks (*) on the screen followed by a new line character

o This should be accomplished using an appropriate loop construct

For each integer from 5 to 10, print out the ‘hailstone sequence’ which starts with that number.

o A hailstone sequence is a series of numbers produced by starting with any integer value and repeatedly applying the following rule:

  • If the number is even, divide it by 2 (using integer division)
  • If the number is odd, multiply it by 3 and add 1
  • The sequence ends when it reaches the value of 1

o For example, consider what happens when we start with the value 6.

  • 6 is even, so we divide by 2 getting 3
  • 3 is odd so multiply by 3 and add 1, getting 10
  • 10 is even, so divide by 2 getting 5
  • 5 is odd so multiply by 3 and add 1 getting 16
  • 16 is even so divide by 2 getting 8
  • 8 is even so divide by 2 getting 4
  • 4 is even so divide by 2 getting 2
  • 2 is even so divide by 2 getting 1 and ending the sequence

o You can read more about hailstone sequences here: https://plus.maths.org/content/mathematicalmysteries-hailstone-sequences

o You must calculate and print the values in these sequences using nested loops – we will cover

these in Week 5

• Draw another 60 asterisks (*) on the screen followed by a new line character

o This should be accomplished using an appropriate loop construct

You should be testing your program as each stage is completed, and again once the program is complete. As well as your program code, you must submit a document detailing the testing which you have performed on your program. This should be formatted according to the University’s guidelines for academic work. This should detail the input data given to the program, why that particular data was chosen, and the expected and actual output from the program. You might choose to structure this as a table as shown below:

352_Untitled.png

Your testing should be thorough, including both valid and invalid data, as well as borderline cases. Your mark for this section will reflect the thoroughness of your testing and the quality of your documentation.

Reference no: EM131091006

Questions Cloud

Question regarding the prejudice and discrimination : Prejudice is an underlying complex mix of mental perceptions and associated emotions and attitudes toward members of another group that often result in social distance and manifest in overt acts of discrimination. An important first step in addres..
Provide an assessment of the reputational issues around tax : Provide an assessment of the reputational issues around tax planning and what responsibilities businesses have to pay tax in different jurisdictions where they do business. Consider the political pressure for reform coming from the OECD and national ..
Quantitative techniques for managers : Quantitative Techniques for Managers
Assessment comprising of precise and critical evaluation : Present a 2-3 page assessment comprising of a precise and critical evaluation. Do not summarize the article. Evaluate the information presented in the article.
Use the correct syntax of a common programming : This assignment requires you to write a Java program to carry out a series of operations as specified below. The appendix at the back of the assignment specification provides an example of the output required from the final program.The tasks required..
Amendments-judicial interpretations : Complete an in-depth analysis of the Railway Labor Act (RLA), including its amendments, judicial interpretations, and administrative law. Having studied the RLA over the past few weeks, you will now tie it together with what you have learned about..
Results of leadership changes : In your overall strategy, be sure to address how a measurement strategy will help determine if the results of leadership changes are positive, help ensure that the process does not have an unanticipated negative impact elsewhere, and help assess i..
Arguments for and against globalization : Discuss the arguments for and against globalization regarding culture, economics and the environment. Describe countries that benefit most/least. What is your opinion regarding globalization?
To what extent and how can the strategy followed by the : To what extent and how can the strategy followed by the company be explained by theories of positioning, resources or other approaches to strategy; and To what extent and why do you consider that the current strategy is likely to succeed?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd