Java程序辅导

C C++ Java Python Processing编程在线培训 程序编写 软件开发 视频讲解

客服在线QQ:2653320439 微信:ittutor Email:itutor@qq.com
wx: cjtutor
QQ: 2653320439
Assignment 1 – FINAL UNSW Blogs Home UNSW Wikispaces UNSW Website MyUNSW RSS Business Programming Course announcements for INFS1609 and INFS2609 Assignment 1 – FINAL Posted by Claude on July 31st, 2011 · Assignments NOTE: check this web site regularly for updates and clarifications to the assignment specification. Due Date: Friday week 5 (23:59:59 19 August 2011) Change Log 2011-08-04 Clarified output of report for the sample program 2011-08-03 Final version, including new report method 2011-08-02 Bugfix: Corrected captalised Fred to fred Task Suppose you are designing a program for an automated teller machine. The ATM generates transactions that are sent to the banks central computer for processing. In this assignment, you will create two classes, “Account” and “Transaction”. An Account object should have a unique account number, which can be represented by an integer, and a balance. Initially the balance is zero. A Transaction object should have an amount being transacted and a reference to the Account class associated with the transaction. Here is an example of the two classes being invoked: /** * This class contains a main method that calls methods in the classes you will write. * * @author (your name) * @version (a version number or a date) */ public class RunTransactions { static void main() { // Create two new accounts with the given account numbers Account fred = new Account(1234); Account jim = new Account(6778); // Provide accessories methods for account information. int accountNumber = fred.getAccountNumber(); float balance = fred.getBalance(); // Transactions consist of an account reference and an amount Transaction t1 = new Transaction(fred, 20); Transaction t2 = new Transaction(jim, 10); Transaction t3 = new Transaction(jim, -20); // Transactions must contain a "process" method that is called to // actually perform the transaction. // A transaction should not be allowed if it results in a negative balance. t1.process(); t2.process(); t3.process(); // Print out a report of the account balance. // The format should be like this: Account 6778 has balance $20.0 fred.report(); jim.report(); } } Download this file. It contains a BlueJ project with just the RunTransactions class. You must create your own Account and Transaction classes. You can create whatever fields and methods you think appropriate but you must provide methods that can be called exactly as above. The report method should print out a simple message giving the account number and balance. The format should be Account has balance $ For example, the output of the reports from the above sample code should be: Account 1234 has balance $20.0 Account 6778 has balance $10.0 You will learn about main methods and the static qualifier in later lectures. For now, you only need to know that when you right click on the RunTransactions class, you will see an item in the menu void main(). Clicking on this will run the main method, which will call your code. You may change the main method to test your code with different combinations of accounts and transactions. Only remember that you must use exactly the same names of classes and methods and the types of arguments are return values must be identical. When you submit your assignment, we test your code with different main methods. Submission instructions You will submit your assignment to the Give automated marked system. From within your assignment 1 BlueJ project, select Project -> Create Jar File… In the Dialog Box that appears: Set “Main Class” to none Ensure “Include Source” is checked Leave “Include Bluej project files” unchecked Press “Continue” Save the filename as “assignment1.jar” Open a web browser and go to the give web site Log-in with you Z-Pass Either enter “INFS1609” in for the course, or select INFS1609/INFS2609 from the drop down menu and press “Search for Assignments”. Note INFS2609 students may need to enter “INFS1609” instead of selecting INFS2609 if the assignment is not listed Select “assignment1” from the next drop down menu and press “Upload my Assignment” Accept the student declaration Press “Choose File” and select the “assignment1.jar” file that you saved in step 4 Press “Submit my Files” Wait for the page to completely load. Then carefully read the output. If the assignment is successful you should see the following lines: Checking your submission... Checking for Account and Transaction classes... All files are OK If the page doesn’t load properly, that is OK just submit the assignment file again. If you see the final line, everything is good. Otherwise check the output to see what went wrong and resubmit. Submission notes: You can submit as many times as you wish, even after the deadline. Only your last submission will be marked. Make sure you name everything the as instructed, including the classes (“Account” and “Transaction”) the submission file (“assignment1.jar”) or the submission will not work. If you have any problems with submission, email the class account Marking Scheme The maximum mark for this assignment is 10. Marks will be awarded as follows: Performance (6 marks) – for a program that produces the correct results under all tests Style (2 marks) – for the structure of your classes, layout and readability Comments (2 marks) – for a well commented program FAQ Will transactions use decimal values? Yes. For the purposes of this assignment, you can assume that floats will be of a sufficient precision. How should we deal with printing floats? Just use the default output generated by Java for printing floats Does the dryrun test my program? No. The dryrun only checks that you have submitted right files. We will run the testing for marking after the deadline for the assignment has passed. Email to friend Stay updated Tags: No Comments so far ↓ There are no comments yet...Kick things off by filling out the form below. You must log in to post a comment. Pages Assessment Course Outline For Tutors Lab Times Lecture Notes Software Categories Announcements Assignments Labs Uncategorized Staff Claude Sammut (Lecturer) Timothy Wiley (Admin/Tutor) UNSW Blogs User Tools Username and Password:          Lost your password? Business Programming Terms of Use Privacy Policy Copyright and Disclaimer Accessibility Acknowledgements UNSW Sydney NSW 2052 Australia Telephone +61 2 9385 1000 UNSW CRICOS Provider Code 00098G ABN 57 195 873 179 Design by jokay