Posts

Showing posts from July, 2016

Monte Carlo method to compute an approximation to π - CS 222 Program 2

Image
The program Your program will use a Monte Carlo method to compute an approximation to π. In a Monte Carlo computation a sequence of random values is generated and run through a model of a system. For our simple program the random values will be used to plot points as described below. You will generate a random sequence of points in the unit square in the coordinate plane and see how many fall inside the unit circle. In the following figure seven of ten randomly generated points fell inside the circle. 7/10 = 0.7 then gives a (very) rough approximation to the ratio: (area of circle segment)/(area of unit square) = π/4 Thus 0.7 is an approximation to π/4 so 4 × 0.7 = 2.8 is an approximation to π. Larger numbers of points will give better approximations. The program will use the above method to compute approxiations to π four times: using 10 points, 100 points, 1000 points, and 1000000 points. It will report the results of each of the computations with the number of points used, the compu

UML diagram of Lottery Lunch according to the case study

Image
BACKGROUND INFORMATION  UNEP would like an application that Will enable them to conduct weekly- lunch lotteries. To participate In the lottetY, staff members have the option to register through an online platform, providing Information such as their name. email address and current duty station. Staff members are only (required to register once and then If they would like to opt-out of the lottery they should have a· means to do so. Every week participants in the lottery will be assigned to have lunch with random colleagues who arc located In the same duty station. They will be rolled off their lunch-h partners and the venue of their lunch through email notifications. The groups can consist of between 2 to 4 participants. DATABASE DESIGN (100 POINTS)  Create an Entity Relationship Diagram for the development of the Lunch lottery application. Ensure the.at you have provided ln depth of any relationships and characteristics of the fields and tables. . CONTACT DETAILS For any other questio

Command Line Arguments ~ String, Numeric Vaues and Employee Object ~ Java Test

Write a Java command line program that takes a list of arguments as follows: operator arg1 arg2 arg3 ... argx argN can be of the form: abcd (a String) 123 (an int) 123.33 (a double) employee(John,Smith,33000) (an Employee) Employee can be defined by a class with firstName (String), lastName (String), and salary (double) properties operator is one of the following: opAdd, opConcatenate, opSortAsc opAdd: add numbers. Adds any argument that is numeric. Ignores non-numeric arguments. opConcatenate: concatenate strings. Concatenates any argument that is a string or numeric. Ignores employee arguments. opSortAsc: sort numbers and strings in ascending order. If an employee is encountered, use its lastName. Your solution should take into consideration that other operators might be added in the future. Your code should change as little as possible in order to accommodate this requirement. Your program should demonstrate your understanding of the following concepts: Object and classes Inherit