News Ticker

Menu

Latest Post

Hacking

Networking

Software

For Dummies

Head First Java

Recent Posts

Simple Trip Planner with file handling in Java complete source

Saturday 7 May 2016 /

Simple Trip Planner

This assignment is inspired by the problem of planning a European holiday by train, making optimal use of travel time. Your aim is to take each of a number of given train trips, e.g. London to Paris. Your journey must include a number of given trips, but may include additional trips to "link up" the cities in the trips you want to take. For simplicity, we assume that trains run frequently, so that you can focus on scheduling a journey that includes all of your specified trips and minimizes time takes to complete the journey (so you don't have to consider time lost waiting around for departures). The trips in your journey can be scheduled in any order, but your journey always starts in London. The aim is to minimize the total journey time, taking into account travel time and a transfer time in each city (except in London at the start of the journey).

We assume that all cities can be reached by train directly from any other city, and that the travel time between any two cities is the same in either direction (so need only be specified in one direction). This means that the travel times between each pair of cities will be given. Furthermore, we assume the following "triangle inequality" on travel times: for any cities A, B and C, the travel time from A to C is always less than or equal to the travel time from A to B plus the travel time from B to C.

In this assignment, you will implement an A* search procedure for the trip planning problem. In your program design, make use of the Strategy pattern to supply a heuristic to the search procedure, and don't forget to ensure that your heuristic is admissible. Implementing A* is the main requirement for this assignment, so that your program is guaranteed to produce an optimal solution. If your program does not always produce an optimal solution, then it is wrong. Assessment will be based on the design of your program in addition to correctness. You should submit at least a UML class diagram used for the design of your program, i.e. not generated from code afterwards. All input will be a sequence of lines of the following form, and all cities and travel times will be declared before any trip requirements:

Transfer <time> <name>
# Transfer time is <time> minutes in city <name>
Time <time> <name1> <name2>
# Travel time is <time> minutes from city <name1> to city <name2>
Trip <name1> <name2>
# Journey requires a trip from <name1> to <name2>

Create all your Java source files in the default package. Call your main Java file TripPlanner.java. Read input from a file whose name is passed as an argument to the main method in the call to java TripPlanner and print output to System.out. For machine marking, the output will be redirected to a text file that will be compared to the expected output (so do not print out extra spaces, etc.) and remember to close the file. For the purposes of machine marking, problems will be used for which there is only one optimal solution, though in the case of multiple optimal solutions, your program should produce one of them.

To read input from a text file (whose name should be passed as a command line argument to java, e.g. java TripPlanner input.txt), use code such as:

Scanner sc = null;
        try {
            sc = new Scanner(new FileReader(args[0]));
           
            # args[0] is the first command line argument } catch (FileNotFoundException e) {
        } finally {
            if (sc != null) {
                sc.close();
            }
        }

Sample Input: 

For example, the following input has five cities and four required trips as indicated. This means that 10 travel times between cities need to be specified (which can be given in any order). The format and meaning of the input is as follows (comments are for explanation and should not appear in the actual input):


Sample Output:

The above example does not have a unique optimal solution. One valid output corresponding to the above input is as follows. The first line in the output should give the number of nodes n expanded in your search, the number of nodes taken off the queue, which will vary according to the heuristic used. The second line of the output should give the cost of the solution found as an integer, which is the total time taken, and should be the same regardless of the heuristic and the solution path. The remainder of the output should give a sequence of trips that make up an optimal solution. If your program produces a different optimal solution from the one shown (with the same cost) then it is correct.

 order now

Simple Trip Planner with file handling in Java complete source - Buy Now

/
Buy now

Simple Trip Planner

This assignment is inspired by the problem of planning a European holiday by train, making optimal use of travel time. Your aim is to take each of a number of given train trips, e.g. London to Paris. Your journey must include a number of given trips, but may include additional trips to "link up" the cities in the trips you want to take. For simplicity, we assume that trains run frequently, so that you can focus on scheduling a journey that includes all of your specified trips and minimizes time takes to complete the journey (so you don't have to consider time lost waiting around for departures). The trips in your journey can be scheduled in any order, but your journey always starts in London. The aim is to minimize the total journey time, taking into account travel time and a transfer time in each city (except in London at the start of the journey).

We assume that all cities can be reached by train directly from any other city, and that the travel time between any two cities is the same in either direction (so need only be specified in one direction). This means that the travel times between each pair of cities will be given. Furthermore, we assume the following "triangle inequality" on travel times: for any cities A, B and C, the travel time from A to C is always less than or equal to the travel time from A to B plus the travel time from B to C.

In this assignment, you will implement an A* search procedure for the trip planning problem. In your program design, make use of the Strategy pattern to supply a heuristic to the search procedure, and don't forget to ensure that your heuristic is admissible. Implementing A* is the main requirement for this assignment, so that your program is guaranteed to produce an optimal solution. If your program does not always produce an optimal solution, then it is wrong. Assessment will be based on the design of your program in addition to correctness. You should submit at least a UML class diagram used for the design of your program, i.e. not generated from code afterwards. All input will be a sequence of lines of the following form, and all cities and travel times will be declared before any trip requirements:

Transfer <time> <name>
# Transfer time is <time> minutes in city <name>
Time <time> <name1> <name2>
# Travel time is <time> minutes from city <name1> to city <name2>
Trip <name1> <name2>
# Journey requires a trip from <name1> to <name2>

Create all your Java source files in the default package. Call your main Java file TripPlanner.java. Read input from a file whose name is passed as an argument to the main method in the call to java TripPlanner and print output to System.out. For machine marking, the output will be redirected to a text file that will be compared to the expected output (so do not print out extra spaces, etc.) and remember to close the file. For the purposes of machine marking, problems will be used for which there is only one optimal solution, though in the case of multiple optimal solutions, your program should produce one of them.

To read input from a text file (whose name should be passed as a command line argument to java, e.g. java TripPlanner input.txt), use code such as:

Scanner sc = null;
        try {
            sc = new Scanner(new FileReader(args[0]));
       
            # args[0] is the first command line argument } catch (FileNotFoundException e) {
        } finally {
            if (sc != null) {
                sc.close();
            }
        }

Sample Input: 

For example, the following input has five cities and four required trips as indicated. This means that 10 travel times between cities need to be specified (which can be given in any order). The format and meaning of the input is as follows (comments are for explanation and should not appear in the actual input):


Sample Output:

The above example does not have a unique optimal solution. One valid output corresponding to the above input is as follows. The first line in the output should give the number of nodes n expanded in your search, the number of nodes taken off the queue, which will vary according to the heuristic used. The second line of the output should give the cost of the solution found as an integer, which is the total time taken, and should be the same regardless of the heuristic and the solution path. The remainder of the output should give a sequence of trips that make up an optimal solution. If your program produces a different optimal solution from the one shown (with the same cost) then it is correct.



Buy now

University Case study - design, develop and document a prototype Database system

Tuesday 3 May 2016 /
Buy now
University Case study - design, develop and document a prototype Database system prototype Database system Design and implement a database system in Oracle based on the case study below. You will be expected to identify the management needs of the organisation and present how they are solved and dealt with by your database design and implementation. ScenarioLondon University is a prestigious institution educating students from all over the world. It offers 40 programmes from five disciplines. The university currently uses an old legacy system which is file-based. Due to various difficulties, the management has decided to modernise the system by having an online system with a backend database.

As a group of consultants, you are required to produce a database system to upgrade a part of the system that handles the student registration and timetabling of students. On arriving at the university each student must be enrolled on a programme and be allocated a personal tutor who would oversee their academic needs at the college. The maximum duration of a programme is 6 years for part-time, and 4 years for the full-time mode. The minimum and a maximum number of modules that make up a year of a programme are six to eight modules for full-time, and four to six for part-time students. Each module weight 15 credits, students are required to obtain a total of 360 credits to be eligible for an award. Each programme must have a student representative. The student rep is the first point of call for fellow students with issues related to the programme, modules, and teachings. Each student must take and pass each module in a given year before they are allowed to move into the next year of the programme or to graduate. A student is normally allowed two attempts to pass a module. A particular module can be offered as part of one or more programmes. The university has 5 departments, each of which offers a number of programmes. Each department has a Head of Department (Dean) and each programme has a Programme Leader. Each module is assigned to a Module Leader who oversees the teaching and assessment of the module. Principal Lecturers manages other teaching staff, which can also include Programme Leaders. Staff details, such as, contact telephone numbers, speciality, qualification and awarding institutions and previous employment must be recorded.

In order to achieve the business needs and ensure consistency of data in the database, you are to develop integrity and referential integrity constraints that will ensure the correctness of the data when it is entered. Below is a list of checks you should implement.

  1. For this study, student gender should be recorded as ‘M’ for male or ‘F’ for female.
  2. The name of a student/staff should not contain any numeric characters.
  3. The staff salary should be greater than £10,000 and not exceed£150,000.
  4. Student email address should have an @ symbol present to be valid.
  5. The classification of module results must only be one of ‘F’, ‘P’, ‘M’, ‘D’, ‘NS’, ‘FX’.
  6. Each student’s start-date of a programme must always have a value.
  7. Each student’s end-date of a programme should not be earlier than their start date and it should be the minimum of 3 years.
  8. The student degree graduation date should be greater than ‘27-Oct- 2015’.
  9. Staff and Student numbers should be generated automatically using a sequence and a trigger.
  10. Assessment
  • A fully UML annotated E-R diagram 1 and 2 showing the entities, primary and foreign keys, composite keys, relationships and optionality.      (15 marks)
  • A relational schema of your database in 3NF, clearly indicating attributes, the data type of each attribute, primary and foreign keys and which attributes are nullable, giving reasons. List any assumptions you need to make.(15 marks)
  • Listings of the records in each table. There should be a minimum of ten records on each table. (5 marks)
  • Ensure consistency of data in the database by developing integrity and referential integrity constraints that will ensure the correctness of the data when it is entered. (10 marks)
  • Produce SQL listings on the specific questions based on the Case Study. (30 marks)
  1. List all students’ details and order by student Id. [3 marks]
  2. List of student reps in all programmes [4 marks]
  3. List the names of all students who are enrolled in the BSc Computer Science and are doing the Database module. [4 marks]
  4. Find the student with the minimum marks in a specific module, giving the name of the student and module. [4 marks]
  5. Give a count of the number of students on a specific module that started on 1st September 2015. [4 marks]
  6. Give total credits acquired by each student. [4 marks]
  7. List the academic’s name and salary and their Principle manager's name and salary for all academic staff who earn more than their managers. [ 7 marks]
  • Documentation must be logically organised with clarity and completeness. TEAMWORK: Documentation stating how each group member participated in the development and completion of the assignment. (5 marks)
  • Group presentation - presenting the design and implementation of the solution in Oracle.(20 marks)

Sample ERD:


Order Now!

Buy now

Round Robin Algorithm - Distributed Network Architectures & Operating Systems

/
Buy now

I. Assessment Requirements

You must work individually on this assessment to develop a load balancer Java application. A report is required which explains what you had to change since assessment 1 and the challenges that you encountered and solved for your project.

II. Assessment Scenario/Problem

Restating the scenario from Assessment 1:For this assignment, you will be taking your design from assessment 1 and implementing it using Java.
Here, your standard or weighted round-robin algorithm will be running on the load balancing machine (i.e. the load balancing program will be working on a single computer) while some client applications will be running on each of the nodes. Your system will need to consider the following functionality and messaging (in no particular order):

  1. Standard/weighted round-robin algorithm working on a designated load balancer machine.
  2. Each node will register with the server by sending a message.
  3. The load balancer will record node details.
  4. The notion of a job (as a message) requires the load balancer to allocate the task to the next free node. The position information will detail the number of seconds that a job will take to run, rather than trying to include some form of code that is required to be executed.
  5. The load balancer will need to store an ordered list of nodes. In the weighted round-robin strategy, the list could be ordered based on the nodes workload (i.e. the number of jobs given to them already by the scheduler). The least weighted node (i.e. the one that has the least amount of work) will be at the top.
  6. Weighted information to determine the order of the scheduled jobs can be gained by remembering how many jobs are currently running on a node.
  7. The load balancer assigns the task to a node by sending it a message to work for X seconds. Nodes will receive job requests and wait for

You will be expected to produce separate programs for:

  1. The load balancer
  2. General worker node (do not hardcode names or IP address into this but instead have these passed in as parameters on the command line)
  3. A program for sending jobs into the systemTo achieve a good mark in this assignment, you will need to (at least):
  4. have different programs as stated above
  5. make use of multiple classes in each program
  6. ensure that the relevant functionality for the class is contained within it
  7. link levels together to form the overall algorithm
  8. use multi-threading where necessary
  9. send, receive and process messages as explained in the lectures (Lecture on messaging systems and covered in lectures 18 / 19).
  10. only use the primary method for extracting information from the arguments passed in from the command line and to start your system
  11. not provide a reliable solution (e.g. all code in one class or primary method)You can choose which load balancing algorithm you will implement. You will be able to get up to 60% for applying a round-robin approach or up to 100% if you use a weighted round-robin approach.For either option, you can provide clients that can be executed on the same machine but as separate programs to the load balancer system. This will allow you to develop and test your distributed system on your home computer, rather than to rely on access to the Raspberry Pis or multiple computers in the lab.The demonstration of your system will take place on a single or multiple devices, depending on what resources are available on the day. Make sure that you test that your programs can work on the same machine or separate machines before the demonstration as you will not be allowed to fix any problems during the presentation.

Order now!


Buy now

User Interface related questions command line, GUI and metaphor

/
Buy now

Question 1 GUI Related:

When input information can effectively be provided by selecting from a list or pointing at an object or position, direct manipulation interfaces are usually considered "easier to use" than interfaces based on textual commands. But direct manipulation interfaces are not always best. What kinds of situations are better served by type-in command-based interfaces? Use examples to illustrate your answer.


Question 2 GUI Related:


Discuss the role of metaphor in relation to the design of user interface components. In particular, identify the advantages and disadvantages of using metaphors when designing interface widgets, giving examples to illustrate your answer.

Order your work now!


Buy now

Extra Credit Assignment 3: Loan Calculator Java Implementation Source Code

Saturday 16 April 2016 /
Buy now

Problem Description

The monthly payments for a given loan are divided into amounts that apply to the principal and to the interest. For example, if you make a monthly payment of $500, only a portion of the $500 goes to the principal and the remainder is the interest payment. The monthly interest is computed by multiplying the monthly interest rate by the unpaid balance. The monthly payment minus the monthly interest is the amount applied to the principal. The following table is the sample loan payment schedule for a one-year loan of $5,000 with a 12 percent annual interest rate. The monthly payment would be $444.24.

Write an application that accepts a loan amount, annual interest rate, and loan period (in number of years) and displays a table with five columns: payment number, the interest and principal paid for that month, the remaining balance after the payment, and the total interest paid to date. Note: The last payment is generally different from the monthly payment, and your application should print out the correct amount for the last payment. Use a formatter to align the output values neatly. If the input values are invalid, then print out an appropriate error message. Decide on the range of valid values for the loan amount, interest rate, and loan period.

Objective

The objectives of this extra credit assignment:
Understand the concept of object-oriented programming.
Understand the concepts of repetition statements.
Understand the use of standard Java classes.
Familiarize with code documentation, compilation, and execution.
Expose to Java syntax, programming styles, and Java classes.

Code Screenshots



Order Now:

Buy now

Extra Credit Assignment 2: Slot Machine in Java with full source code

/
Buy now

Problem Introduction:

Write an application that simulates a slot machine. The player starts out with M coins. The value of M is an input to the program, and you charge 25 cents per coin. For each play, the player can bet 1 to 4 coins. If the player enters 0 as the number of coins to bet, then the program stops playing. At the end of the game, the program displays the number of coins left and how much the player won or lost in the dollar amount. There are three slots on the machine, and each slot will display one of the three possible pieces: BELL, GRAPE, and CHERRY. When certain combinations appear on the slots, the machine will pay the player. The payoff combinations are these:
The symbol --------- means any piece. If the player bets 4 coins and gets combination 5, for example, the machine pays the player 12 coins.

Code Screenshot:


Order Now:

Buy now