24 Jul DPIT111 Assignment 1Week 4Objectives• Data types, variables,
DPIT111 Assignment 1Week 4Objectives• Data types, variables, constants• Expressions, math methods, executable statements• Input and output• Comments• Class and objectAssignment 1 (12%) is marked on a scale from 0-12 marks.• Question 1: 3 mark• Question 2: 3 mark• Question 3: 3 mark• Question 4: 3 markImportant notices:This assignment is scheduled to be done in Week 4 (Monday 30 March – Sunday 5 April 12:30 pm). Comments for your work can be checked on Moodle site. You may be asked questions about your code. Your marks will be deducted if you could not answer the questions presented by the assessor.1. Students must submit all assessment tasks by the due date or penalties will be applied.No. of calendar days late Penalty1 10% of the original mark.2 20% of the original mark.3 30% of the original mark.More than 3 A mark of zero will be awarded for the assessment.2. Make sure that you include following personal information in every file, otherwise it will result in 0 points./*—————————————————— My name:My subject code:My student number: My email address:Assignment number: charteredessay.com/dpit111-assignment-1-week-4- 3. Ensure each file in your submission is runnable, compiling error in your file will result in 0 points for the current question. If it is runnable, though it fails to realize all functionalities, you can get partial points for what you have done.Question 1 (3 mark) : In the Cartesian coordinate space, the radius of a circle centered at the original can be calculated as ?? = ?? + ?? , where (??, ??) is the coordinates of a point on the circumference. Write a program to ask the user to enter the horizontal coordinate x and the vertical coordinate y, calculate the radius r and then display it.REQUIREMENTS• The user input is always correct (input verification is not required).• Your code must use Scanner class• Your program shall input parameters in the following order:– horizontal coordinate ?? – vertical coordinate ??• The program shall perform all calculations with double data type. The radius shall be displayedwith 3 decimal point precision.• Your code must work exactly like the following example (the text in bold indicates the user input).Example of the program output:Enter x: 3Enter y: 4Radius = 5.000Question 2 (3 mark) : If you look at the ASCII Character Table, you’ll notice that the difference between uppercase and lowercase character codes is 32. Implement a program to ask the user to enter a string of all lowercase characters and a non-negative integer position, convert the lowercase character at index position to the corresponding uppercase character and then display it.REQUIREMENTS• The user input is always correct (input verification is not required).• Your code must use Scanner class• Your code should include a method called char convert(String, int) whose arguments are a String and an int, return value is a char.• Your code must work exactly like the following example (the text in bold indicates the user input).Example of the program output:Enter a string: yournameEnter an index: 4The uppercase of 5th letter of yourname is NQuestion 3 (3 mark) : Implement a program to ask the user to enter two strings and one integer position, concatenate the substring (before index position) of the first string and the substring (from index position to the end) of the second string into a string and then display it.REQUIREMENTS• The user input is always correct (input verification is not required).• Your code must use Scanner class• Your code should include a method called String stringMerge(String, String, int) whose arguments are two Strings and an int, return value is a String.• Your code must work exactly like the following example (the text in bold indicates the user input).Example of the program output:Enter the first string: abcdefgEnter the second string: HIJKLMNEnter an index: 3The merged string of abcdefg and HIJKLMN is abcKLMNQuestion 4 (3 mark) : Implement a program according to the following UML diagrams to ask user to input contact information and display it:REQUIREMENTSPerson class:• The constructor Person (int, String, int, String, String, int) shall initialize its data fields, i.e. two component objects of type class Address (the work address and the home address), email address of String type and phone number of long type. The 6 arguments refer to the street number of work address (int), the street name of work address (String), street number of home address (int), the street name of home address (String), the email address (String) and the phone number (int), respectively.• The method getEmail() is to access email address of data fields.• The method getPhone() is to access phone number of data fields.• The method printContactInformation() is to display all contact information about Person class, using class data fields and methods.• In the main(String []) method, the program shall first ask the user to input contact information details, then create an object of class Person based on these inputs, using its constructor with 6 arguments, finally call printContactInformation() method to display contact information.Address class:• The constructor Address(int, String) shall initialize its data fields, i.e. the street number (int) and the street name (String), the suburb (String), the post code (int) and the state (String). The 2 arguments refer to the street number and the street name. The remaining static data fields suburb, post code and state should be respectively initialized as “Wollongong”, 2500 and “NSW” by default.The initialization of these 3 data fields can either be explicit or in the constructor.• The method getAddress() is to generate the displaying address information using class data fields.• The user input is always correct (input verification is not required).• Your code must use Scanner class• Your code must contain 2 classes• Your code must work exactly like the following example (the text in bold indicates the user input).Example of the program output:Enter the street number work address: 11Enter the street name of work address: Steel St Enter the street number of home address: 12Enter the street name of home address: Apple AveEnter the email address: [email protected]Enter the phone number: 420400000Work address: 12 Apple Ave, Wollongong 2500, NSWHome address: 11 Steel St, Wollongong 2500, NSWEmail: [email protected]Phone Number: 420400000Submission requirements:1. Put all your .java files into a folder. Compress this folder into .zip file and submit it via the link Assignment 1 Submission on Moodle.2. Submission via email is not acceptable without permission.3. Enquiries about the marks can only be made within a maximum of 1 week after the assignment results are published. After 1 week the marks cannot be changed.Mark deductions: late submission, compilation errors, incorrect result, program is not up to spec, poor comments, poor indentation, meaningless identifiers, required numeric constants are not defined, the program uses approaches which has not been covered in the lectures. The deductions here are merely a guide. Marks may also be deducted for other mistakes and poor practices.END OF THE ASSIGNMENT
Our website has a team of professional writers who can help you write any of your homework. They will write your papers from scratch. We also have a team of editors just to make sure all papers are of HIGH QUALITY & PLAGIARISM FREE. To make an Order you only need to click Ask A Question and we will direct you to our Order Page at WriteDemy. Then fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Fill in all the assignment paper details that are required in the order form with the standard information being the page count, deadline, academic level and type of paper. It is advisable to have this information at hand so that you can quickly fill in the necessary information needed in the form for the essay writer to be immediately assigned to your writing project. Make payment for the custom essay order to enable us to assign a suitable writer to your order. Payments are made through Paypal on a secured billing page. Finally, sit back and relax.
About Writedemy
We are a professional paper writing website. If you have searched a question and bumped into our website just know you are in the right place to get help in your coursework. We offer HIGH QUALITY & PLAGIARISM FREE Papers.
How It Works
To make an Order you only need to click on “Order Now” and we will direct you to our Order Page. Fill Our Order Form with all your assignment instructions. Select your deadline and pay for your paper. You will get it few hours before your set deadline.
Are there Discounts?
All new clients are eligible for 20% off in their first Order. Our payment method is safe and secure.