This assignment is to create a Tic Tac Toe game in Java. I have attached the assignment outline detailing what is needed to be done in the assignment (index.pdf). The assignment must be done using the given java files in the zip folder (a1_3000000_3000001 (5).zip). There are also Junit files to test the code.
Category: Computer science and IT assignments
Create a class called GermanToEnglishDictionary and a HashMap from String to String in that class called content. You will need to import java.util.HashMap. Create a no-args constructor that creates the content eld as an empty map.
Create an enumerated type (enum) called Coin that can take the values ONE PENNY, TWO PENCE, FIVE PENCE, TEN PENCE, TWENTY PENCE, FIFTY PENCE, ONE POUND and TWO POUNDS.
Loan Calculator
You’ve been hired to do some programming for Metro Bank. They want you to create a program to calculate loan payments. The user will enter the amount of money to borrow from the bank, the annual percentage rate (that will be compounded monthly) and the number of years to pay back the loan. The program will then display the monthly payment and the total amount of interest that will be paid. Also, to be more helpful to the user, display these same results using a loan amount of 10% more and 10% less.
Objectives
writing your own functions with parameters and return values
gaining more experience working with calculations
User Interface
INPUT
After displaying a user introduction, the program asks for:
the amount of loan in dollars,
the length of loan (in years), and
the annual percentage rate.
For the percentage rate, the user enters a percentage value. For example, if the percentage rate is 5%, the user should enter 5, not the decimal 0.05. Programs should not make the user do the math.
Make sure that the prompt clearly tells the user what to input and the units for each input.
OUTPUT
The program must first redisplay the original input. Then,
display the monthly payment and the total interest (see formulas below).
display monthly payment and total interest using a loan amount of +10% and -10% to give the user a range of results.
All dollar amounts must be displayed with exactly 2 decimal spaces. All displayed values need to be properly labeled.
Formulas and Code Specifications
Periodic Payment
Let:
A = amount of the loan
r = interest rate per month as a decimal, not percentage
n = the number of months
Then the formula to find the monthly payment is:
payment.gif
Total Interest Paid
Let:
P = the monthly payment
n = the number of months
A = amount of the loan
Then the formula to find the total interest is:
Total Interest = nP – A
Functions:
For this program, you will write a function to calculte each of the formulas above. Remember that once you have written a function you need to call it to get it to execute.
Write a function defintion that is passed in the amount of the loan, the number of periods, and the interest rate per period (as a decimal) and returns the monthly payment.
Notice that the units of the parameters are the same as the units in the formula. However, these are different from the units input by the user. So you’re program will need to do some unit conversions before calling the function.
Write a function definition that is passed in the monthly payment, the number of periods, and the amount of the original loan and returns the total interest paid. Again, be mindful of units.
Also, be aware that since you are formatting the monthly payment to 2 decimal places, that must also be the value used to calculate total interest. Otherwise, you’ll have a rounding error.
Since the program needs to output 3 sets of results (results for the user input loan, as well as + 10% of loan amount and -10% of loan amount) put the code to display the output nicely into one function and call it for each set of data.
This means your program will have a minimum of 4 function definitions: main(), the 2 calculation functions, and a display function.
How to Get Started
The first step I recommend is to implement the periodic payment function and test it, similar to lab 3. Reread the description, identify the parameters and the return, then work on the calculation. Once you have written the function, test it by calling the function and displaying the results. Perform some calculations by hand to confirm that the function works properly.
Next, implement and test the other calculation function.
Here are some test data to use for testing your functions. Remember to make sure you are using the correct units. For example, a loan length of 3 years does not mean to pass in a 3 to the periodic payment function. How many monthly payments are there in 3 years? That’s the number to pass in. You’ll have to do a similar conversion on the interest rate: annual percentage rate is not the same as periodic decimal rate.
loan amount = $5000
loan length in years = 3
annual rate = 12%
monthly payment = $166.07
total interest = $978.52
loan amount = $1500
loan length in years = .25 (3 month loan)
annual rate = 12%
monthly payment = $ 510.03
total interest = $ 30.09
Once you have gotten these functions to work, then focus on the main() function to complete the user input and the final display.
Documentation & Style Specifications
Refer to the Comment Descriptions and Documentation Standards page in Canvas.
Include header comments at the top of the file listing that has your name, date, and a description of the program (remember, this is different than a user introduction). The description should be 2 or more lines long describing what the program does.
Include block comments for each function definition, except main(), to describe what it does. These block comments go directly above the function defintion.
make sure to describe parameters and return values. Follow the style you see in the posted examples.
Include blank lines to separate function defintions and blocks of code.
Use descriptive variable names.
Use named global constants for the increase/decrease in loan value.
Use comments elsewhere that you think would help guide the reader. You don’t want to overdo it though. Not every line of code needs a comment. Think in terms of blocks, or if a calculation is not clear.
Assume the reader has not read the homework assignment.
Assume the reader knows Python.
This assignment asks you to build simple Unix shell and gives you in the process an opportunity to
demonstrate that you are mastering concurrency (including running external executables) and file
manipulation using the POSIX API. You may have seen similar assignments in other courses but
they are similar and not identical; make sure you follow the specifications herein, not something
else.
Our shell repeatedly provides a prompt, accepts a command (possibly with arguments), and
executes it. Most commands are external executables, but some are internal.
The shell ignores completely its environment and reads a simple configuration file upon
startup instead. The file is named shconfig and resides in the current directory. It contains pairs
consisting in a variable name and a value for that variable, separated by at least one blank. The
two interesting lines in this file have the form
VSIZE v
HSIZE h
where v and h are strings representing positive integers. These variables are used by the internal command more. If these lines do not exist (or if the file is missing altogether), two such lines
must be appended to the configuration file (which must be created first if not already there) with
the values 40 for v and 75 for h. The configuration file may contain other lines, which should be
ignored.
The following functionality should then be implemented:
All the typed in commands should be considered external except the commands more and
exit. Your shell should attempt to execute these commands. The search path for the external
commands contains only the directories /bin and /usr/bin (so any command outside these
directories should be ignored unless it is given by absolute path). If the command cannot
be found, then the shell should print an appropriate message; if the command produces an
error during its execution, then the shell should print yet another appropriate message (in
addition to whatever is printed by the command itself).
The arguments for the commands are provided in the same manner as in normal shells.
A command may be prefixed by the character & followed by a blank. If this is the case, then the
command is executed in the background, in the sense that the shell presents the prompt (and
accepts another command) before the completion of the previous command. Whenever the
background command terminates (with or without errors) the shell must print an appropriate
message, again in addition to whatever is printed by the command.
1
The command more must be implemented internally. This command receives one file name
as argument, and displays it to the standard output page by page. The number of columns
in a page and the number of characters in a column are taken from the configuration file and
are given by the value v of variable VSIZE and by the value h of variable HSIZE, respectively1
.
The command more displays v lines of the file given as argument and then awaits user input.
If the input is the character blank, then the next v lines are displayed; if the input is anything
else, then the command terminates. The command also terminates when it reaches the end
of the file. All the lines are displayed truncated to h characters if necessary (i.e., if they are
longer than h characters).
The command exit terminates the shell.
What to submit For this assignment you must use the POSIX interface presented in class for file
access rather than library functions.
The default target of your makefile must produces an executable named sshell and residing
in the root directory of your submission
This is only for DIY part of the given Workshop 3. Update the Train module to provide a stronger sense of encapsulation while also creating additional functions. As you work on the DIY, it is recommended to look over the provided main program to gain hints on how to implement the requirements. More detailed and proper instructions are provided in the attached PDF file.
answer Chapter 2-1 questions 1-5 on page 74
be sure to add comments to show where you answered question on the document
There might be some error in my document because ive started it. If you look at chapter 2 in the book it walk you threw how the game is suppose to look. For some reason mine had trpuble running. save as rb. file
Download and unzip IA02.zip
Modify the code so that FederalExpress and UnitedParcelService
implement the IShipper interface
That may involve some renaming of methods in the implementing classes
But do NOT change any of the Java code in IShipper.java
Add a 3rd shipping company named PlanetExpress
It must implement IShipper
PlanetExpress.outputProducts() must output all the fields that are
in the Product class
It must be neat and readable
Don’t just jam all the data together
It must output the total count of items to be shipped
It must output the total weight of items to be shipped
Add this new shipper to Menu.runDemo()
Sample output –
How do you want to ship your order?
1) FedEx
2) UPS
1
Your shipment is being processed by Federal Express
Items getting ready to ship:
1 Mechanical Keyboard (5.2 oz)
1 Wireless Mouse (1.3 oz)
3 HP Monitor (25.1 oz)
2 Aperion Speakers (20.8 oz)
Total number of items: 7
When choosing UPS:
How do you want to ship your order?
1) FedEx
2) UPS
2
Your shipment is being processed by UPS
Items getting ready to ship:
Mechanical Keyboard [1]
Wireless Mouse [1]
HP Monitor [3]
Aperion Speakers [2]
After you add the 3rd shipper:
How do you want to ship your order?
1) FedEx
2) UPS
3) Planet Express
3
Writing the output for the PlanetExpress is part of the assignment, so I’m
not including it here
Read the Details section closely
the file is attached.
Create a Java project in IDE and begin the Project Program by developing a Java Method to print the programming specifications for the project.
Expand the Project Program and create Java code to input from the console (keyboard) the first quiz grade. Use a loop to allow the user to continue to enter grades as long as they don’t enter 999 to quit.
Expand the Project Program and create Java code to populate the array the student’s quiz grades. The grade is added to a running total, and the count of grades entered is incremented. If the grade entered is the 10th grade, the grade is forced to 999 and the loop ends; otherwise the user enters another quiz grade. When the loop ends count holds the number of grades entered.
Expand the Project Program and create Java code use another loop to print all grades in the array.
Expand the Project Program and create Java code to compute the average quiz grade.
Expand the Project Program and create Java code to us decision logic to find out the letter grade of the average based on the following grading scale and print to the console.
A = 90-100
B = 80-89
C = 70-79
D = 60-69
F = 0-59
Please see the attachment file for more information.
C program that can be able to add a friend ship, remove a friendship, and print out the friend(s) for a particular user. You can assume that friendships go both ways, i.e. if A is friends with B, then B is also friends with A.
Input:
The input will begin with an integer q (q 500,000), number of queries to your webpage. The next q lines will each contain 1 server query. There are 3 query types. The first query type is the add query. The add query will begin with the word ADD followed by two names, a and b. The word ADD and the names will all be separated by a single space. This query implies the people named a and b have become friends. The second query is the remove query. The remove query
will begin with the word REMOVE followed by two names, a and b. The word REMOVE and the two names will be separated by a single space. The remove query will denote that user a and b are no longer friends. The last query type is the list query. The list query will begin with the word LIST followed by one name, a, representing the user we wish to list the friends of. Each name will be at most 100 lower case characters and will contain no whitespace. No user will become a friend of themselves. No user will remove themselves as a friend. If a friendship is added, it will be between two users that are currently not friends. If a friendship is removed, it will be between two users that are currently friends.
Output:
For each list query print out on a line by itself the number of friends the user has. After which print out the names of each friend of the given user (in any order) each on their own line.
I have a basic code. I want to clean up all the hard coding in this basic code and make it more efficient.
What has to be done?
1) Read a json which has arrays into separate template hash map for each type in the array
2) Without using any hard coding, use the template and compare a new json for new and missing fields.