Posts

Showing posts from March, 2017

Java Object Oriented Practice Questions with source code

Question 1: A ggregation and Inheritance What relationship is appropriate between the following classes: aggregation, inheritance, or neither? State your reasons for each answer. a) Wheel-Bicycle b) Banana-Fruit c) Lamp-Bulb d) Flute-Guitar e) Rainbow-Colour Question 2: Alphabets to numeric values a) Using recursion, compute the sum of all numeric values of each character in a string that are in the range a-z, where a=1, b=2, … z=26. Any other character has no value. The method is case-sensitive, so uppercase letters have no value. Call the recursive method from main(). b) Now add a class called StringConverter in its own .java file, which has a recursive static method like the one just created but has an extra parameter called caseSensitive which if set to false will treat uppercase letters as lowercase letters. Call this new recursive method statically from main(). For example if this is called on the string abCde with caseSensitive set to false, it will return 15. With caseSensitive

Recursive list mnemonics telephonic numbers with GUI for Learners

Image
Recursive list mnemonics On most telephone keypads the letters of the alphabet are mapped to various digits. In order to make their phone numbers more memorable, service providers like to find numbers that spell out some word (called a mnemonic) appropriate to their business that makes that phone number easier to remember. For example, the phone number for a physician called Smith could be 377 -6484 (DRSMITH). Write a method listMnemonics that will generate all possible letter combinations that correspond to a given number, represented as a string of digits using a recursive function. This is a recursive backtracking problem, but you are trying to find all the "solutions", not just one. In fact you are trying to find all possible Strings using the English alphabet, not just Strings that are actual "words". For example, if you call the method listMnemonics with the value 623 your method shall generate and return the following 27 possible letter combinations that corr

Banking application in Java with source code for Learners

Banking System Your assignment is to create a file called BankAccount.java containing a class BankAccount (there is no main method in this class). A BankAccount has an initial balance type double and an id type String. You also should have a static variable to keep track of the number of accounts. The class BankAccount must include the following constructors and methods. (If your class does not contain any of the following methods, points will be deducted.) Methods & Constructors Description public BankAccount( ) : Default constructor, sets the id to "???" and balance to 0.0; public BankAccount (String initID, double initBalance): Constructs a BankAccount by setting the id to initilID, and balance to initBalance. Increment the count to keep track of the number of accounts created. public BankAccount (String customerInfo): Constructs a BankAccount object using the string containing customer's info. You need to extract the bankaccount id and the initial balance. An e

Student Registration System Web Project using HTML, CSS & PHP

Student Registry System In this task, you’re to further develop the student registry you started on lab-task. The solution is based the on the use of HTML5, stylesheets, and PHP, and will use a database for storage of information, MySQL on (school website) is used for this. Information of students is saved in the table student, ID is primary key and is set In addition to this, you need a table named class where id a is the primary key and is set up with AUTOINCREMENT, other columns and data types in accordance with the figure. The property class in the student table needs to be a foreign key that refers to the ID column in the class table. In MySQL you need to use tables of the type INNODB with support for foreign keys, reference integrity shall remain. The task: Write a class with the name StudentRegister (means Student registry), the class should use PDO and only prepared statements/questions. The class shall implement the interface StudentInterface, and use the two classes, Student,

Closest Event Finder in Java with complete source code

Requirements - Code in any language you like but please provide clear instructions on how we should build & run your code - Please use any source control system you like, and send us a link (or if you prefer just a zip of your project) - The first requirement is your code meets the requirements - Secondary requirements are whether your code is idiomatic for the language being coded in, easy to read, and clearly laid out Scenario - Your program should randomly generate seed data - Your program should operate in a world that ranges from -10 to +10 (Y axis), and -10 to +10 (X axis) - Your program should assume that each co-ordinate can hold a maximum of one event - Each event has a unique numeric identifier (e.g. 1, 2, 3) - Each event has zero or more tickets - Each ticket has a non-zero price, expressed in US Dollars - The distance between two points should be computed as the Manhattan distance Instructions - You are required to write a program which accepts a user location as a pair