In Java please!!
Your objective is to beat the dealer's hand without going over 21. Cards dealt (randomly) are between 1 and 11. You receive 2 cards, are shown the total, and then are asked (in a loop) whether you want another card. You can request as many cards as you like, one at a time, but don't go over 21. (If you go over 21 it should not allow you any more cards and you lose) Determine the dealer's hand by generating a random number between 1 and 11 and adding 10 to it. Compare your hand with the dealer's hand and indicate who wins (dealer wins a draw)
In: Computer Science
C language
Write a program in C to implement Queue and its operation (like create, insert, delete, search) using array data structure.
In: Computer Science
Write a program using C++ that ask the user for the flowing: How many shares to be bought: The price per share: Percent commission for the broker for each transaction: Average annual return as of percentage: The program should calculate and display the following: The amount paid for the stock alone (without the commission) The amount of the commissionThe total amount of paid (the payment for stock plus the commission) After TEN years, your shares will worth:
In: Computer Science
5) Name the data model that is only used to document a database design.
6) State the most important characteristics regarding the output of any relational algebra operation.
7) Name the software system that permits the data in a distributed database to be transparent to others.
8) Use two words to distinguish a file based system and a database.
In: Computer Science
(Full Program)Write code that shows how deadlocks work. Then write code that shows a fix using semaphores.
(Full program)Write code showing the elevator algorithm.
c++ Language
In: Computer Science
Solve this problem using pointer variables for parameter passing, where appropriate and pointer arithmetic when working with arrays
Please use the "C" program toProduce the EXACT output shown at the end of the document.
1.Generate a graph that compares, on a month-by-month basis, the monthly rainfall for Kamloops for the first half of 2018 (i.e. Jan – June) versus the normal (30 year average) rainfall for Kamloops for the same months.
Input will consist of 6 pairs of numbers representing the normal rainfall for the month and the 2018 rainfall amount for the same month. Use the exact data shown below when you run your program, (Note: the data and output below are for illustration purposes only. Your program must be able to work with any data that has this format)
Rainfall comparison for January to June 2018
January |***********
|!!!!!!!!!!!!!!!!!!!!!!!!!
|
February |***************
|!!!!!!!!!!!!!!!!!!!!!
|
March | etc for the rest of the months
|
June |*****************
|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|----1----2----3----4----5----6----7----8
LEGEND:
* - normal rainfall for a given month
! - 2018 rainfall for a given month
Total normal rainfall was xx.x mm.
Total rainfall for 2018 was yy.y mm.
2018 was a drier year than normal by z.z mm. (or print wetter or equal if that is appropriate)
The month in 2018 with the highest rainfall was …
In: Computer Science
Write a two-page report which states clearly all the differences between Hadoop 1, 2 & 3. Explain the function of every daemon in all the three versions.
In: Computer Science
1. when you create a class by making it inherit from another class, the new class automatically, contains the data fields and _____ of the original class
a. fonts
b. methods
c. class names
d. arrays
2. if a programming language does not support ________, the language is not considered object oriented
a. syntax
b. applets
c. loops
d. polymorphism
3. when you create a class and do not provide a ______, java automatically supplies you with a default one
a. constructor
b. argument
c. header
d. name
4. when tou employ ______, your data can be altered only by the methods you choose and only that you can control
a. virtual methods calls
b. polymorphism
c. information hiding
d. inlining
In: Computer Science
I need this in java
A6 – Shipping Calculator
Assignment
Introduction
In this part, you will solve a problem described in English. Although you may discuss ideas with your classmates, etc., everyone must write and submit their own version of the program. Do NOT use anyone else’s code, as this will result in a zero for you and the other person!
Shipping Calculator
Speedy Shipping Company will ship your package based on the weight and how far you are sending the package, which can be anywhere in the world. They will only ship small packages up to 10 pounds. You need to have a program, which will help you determine how much they will charge.
The charges are based on each 500 miles shipped. The mileage should be in whole numbers. They are not prorated, i.e., 600 miles is the same charge as 900 miles; in other words, 600 and 900 miles is counted as 2 segments of 500 miles each.
Here is the table they gave you:
Package Weight Rate per 500 miles shipped |
Charge |
2 pounds or less |
$1.50 |
More than 2 but not more than 6 |
$3.70 |
More than 6 but not more than 10 |
$5.25 |
Your code needs to validate the input completely, e.g., the weight and mile amounts must be positive. If an input is invalid, e.g., the weight is zero or less, you should display an appropriate, professional error message, e.g., Error: Weight must be greater than zero!, which should be offset and surrounded by white space, so it stands out, and repeat getting that input until valid input is received. Keep in mind, the user will find it annoying if they must enter both the miles and weight at the same time, and only one of them caused an error, or they must reenter already valid data. Also, make sure you follow the Code Conventions and good programming practices, e.g., appropriately initialize variables to zeros, avoid stacked if or if-else constructs unless necessary, don’t use break or continue to get out of a loop, goto, etc.; in other words, you should NOT use stacked if/if-else constructs, break, or continue for this assignment.
At this point for the code, you should only solve the problem using what you learned from modules 1 – 6, i.e., NO arrays, functions other than main(), etc. Only if all the input is valid, should the program calculate and display one shipping charge, and pause, but not quit, before proceeding to a new customer. Your test cases should test the various possibilities, and the limits of the program, which means, you will need to use an appropriate loop, which will ask if you would like to process the next customer or not by asking them to enter an appropriate value. Once there are no more customers to process, the program should display Good-bye! and end. Remember to solve each aspect of the program separately, and then, put the parts together.
Hints: You may need to reset any values after you display the answer and before you get the input for the next customer. Big Helpful Hint: For the number of segments calculation, you may want to start with integer division, e.g., 1200 miles / 500 miles per segment = 2 segments, and then, expand on that.
You should be able to solve this problem with only one loop.
Sample Run
Enter the number of miles as a whole number: 0
Error: Miles must be greater than zero!
Enter the number of miles as a whole number: 1
Enter the weight of the package in pounds: 0
Error: Weight must be greater than zero!
Enter the weight of the package in pounds: 1
The cost to ship your package is: $1.50.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 500
Enter the weight of the package in pounds: 2
The cost to ship your package is: $1.50.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 500
Enter the weight of the package in pounds: 2.5
The cost to ship your package is: $3.70.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 500
Enter the weight of the package in pounds: 6
The cost to ship your package is: $3.70.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 500
Enter the weight of the package in pounds: 11
Error: We don't ship packages over 10 pounds!
Enter the weight of the package in pounds: 10
The cost to ship your package is: $5.25.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 501
Enter the weight of the package in pounds: 3.75
The cost to ship your package is: $7.40.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 1000
Enter the weight of the package in pounds: 6.1
The cost to ship your package is: $10.50.
Enter 1 to continue or 0 to quit: 1
Enter the number of miles as a whole number: 12450
Enter the weight of the package in pounds: 1
The cost to ship your package is: $37.50.
Enter 1 to continue or 0 to quit: 0
Good-bye!
Press any key to continue . . .
Create an IPO Diagram Here
Input |
Process |
Output |
Test Case 1
Input Data |
Expected Results |
Weight: 1.5 pounds Miles: 200 miles (This is one 500-mile segment.) |
Your shipping charge is $1.50. |
Test Case 2
Input Data |
Expected Results |
Weight: 5.6 pounds Miles: 1200 miles (This is three 500-mile segments.) |
Your shipping charge is $11.10. |
Create Test Cases 3 – 5 Here
Your test cases must be unique, i.e., do NOT use the examples in this document, except concerning those, which produce an error. Make sure they are good, e.g., test for errors, before and after ends of ranges, etc. Feel free to include more test cases to thoroughly test your program.
Paste the Code Here
Paste any related Execution Windows (Screenshots) for All Customers, i.e., All Test Cases, Here
Post new questions in the Q & A discussion, if you are stuck or there is something in this, about which you are confused.
In: Computer Science
this is one assignment
There will be a discussion in class about this assignment
What to do.
Create a simple database with three fields : ID, LastName, FirstName all as Strings. You should define a class called StudentRecord or DataBaseRecord with three private String elements (the three fields), along with the appropriate methods. Here's what mine looked like:
public class StudentRecord{
private String fname;
private String lname;
private String ID;
DataBaseRecord(String f,String l,String i)
{
this.fname=f;
this.lname=l;
this.ID=i;
}
public String toString()
{
return(fname+" "+lname+" "+ID);
}
public int compareTo(Student otherStudent)
{
return(LastName.compareTo(otherStudent.LastName));
}
}
You should also declare an object called DataBaseArray which is an array of DatabaseRecords. Records of type DataBaseRecord should be added at the end of the DataBaseArray. Create an IndexRecord class:
public class IndexRecord {
private String key;
private int where;
//other stuff here
}
Now create an IndexArray. This is an array of IndexRecord and is to be implemented That is, insertions must maintain the order in the array, where order is maintained by the key value. Note that this means you need to define a compareTo method in the IndexRecord object.
The OrderedArray class was an array of objects of type Student.
To print out the array, we included a method called printIt() that
printed out the entire array. But suppose we wanted to do the
following: we wish to retrieve an element from the array, do
something with it, and then retrieve the next element in the array.
Why (or when) you might wish to do this will become apparent as you
work on the programming assignment.
We need an iterator.
An iterator is an element that is part of the OrderedArray object;
it is a current pointer to an element in the array. We can
initialize this pointer to the beginning of the array or the end.
We can advance the pointer forward or backward.
Finally, and most importantly, we can retrieve the element in array
referenced by the iterator. The declaration of an iterator in our
example would be:
public class OrderedArray
{
private Student data[ ];
private int nextElem;
private int maxSize;
private int theIterator;
//we add an iterator;
.......
We can initialize the iterator to reference the beginning of the
array or the end of the array. We agree that if the array is empty,
either initialization should set the iterator to -1:
public void setIteratorBegin()
{
theIterator=(nextElem>0? 0 : -1);
}
public void setIteratorEnd()
{
theIterator=(nextElem>0 ? nextElem-1 :
-1);
}
Finally, there are three methods that return an instance of a
Student:
/* getIterator returns a reference to the Student currently
referenced by theIterator
/* if theIterator==1 return -1
public Student getIterator()
{
return(theIterator==-1 ? null
:data[theIterator]);
}
/* advance theIterator. If we run off end, set to -1
/* if theIterator==-1 return null, else the reference to the entry
in the array
public Student getIteratorNext()
{
theIterator=(theIterator==nextElem-1? -1:
theIterator+1);
return(theIterator==-1? null :
data[theIterator]);
}
/* decrement theIterator. If we run off
the beginning of the array, set to -1
/* if theIterator==-1 return null, else the reference to the entry
in the array
public Student getIteratorPrev()
{
theIterator=(theIterator==0? -1:
theIterator-1);
return
(theIterator==-1?null:data[theIterator]);
}
So what does all this get us ? See the following code to traverse
the array foward or in reverse:
public class UseOrderedArray {
public static void main(String[] args)
{
Student s;
OrderedArray myArray=new
OrderedArray(20);
myArray.insert(new
Student("smith",16,(float)2.7));
myArray.insert(new
Student("adams",15,(float)3.1));
myArray.insert(new
Student("morris",17,(float)3.3));
// print in reverse
order
myArray.setIteratorEnd();
for(s=myArray.getIterator();
s!=null;s=myArray.getIteratorPrev())
System.out.println(s);
// print in forward
order
myArray.setIteratorBegin();
for(s=myArray.getIterator();
s!=null;s=myArray.getIteratorNext())
System.out.println(s);
}
}
The data! Please note the format is: last_name first_name student_ID Read into your own file Dunn Sean 31111 Duong Geoffrey 29922 Fazekas Nicholas 31100 Prezioso Stefano 22223 Puvvada Mohana 11224 Ravikumar Rakhi 11226 Salyers Matthew 11227 Gillespie William 49587 Hess Caleb 29282 Armatis Jared 34512 Beckman Allan 35176 Wang Zhen 22113 Wingett Jordan 12345 Belt Keith 34987 Bixler Tyler 22234 Chambers Quentin 22567 Chinni Adithya 28456 Donheiser Michael 28456 Kondrashov Mikhail 33331 Kraus Laura 33332 Krupp Phillip 49888 Maass John 44112 McCarty Amanda 44223 Moldovan Gregory 44335 Oshiyoye Adekunle 44556 Pagalos Frank 33112 Perski Zackery 33221 Saunders Jordan 77556 Simpson Ashlynne 77665 Szalai Kyle 33112 Witting Robert 21354
/**
* This will be the main driver program for many of your programs.
Specifically,
* you will need to define a data structure and related algorithms
to use with this program.
* We will be using the data file I have provied for you: a file of
68 records. Each record is composed
* of three fields:
* String lastName
* String firstName
* String ID
* ID may be implemented as an integer, but it is easier to
implement as a string. Both lastName and firstName
* may not be unique, but the ID **is** unique.
*
*
*/
import java.util.*;
public class COSC311Driver
{
public static void main(String[] args)
{
/*The following
declaration declares a data structure that will change from one
assignment to the next. For example, you will need to
implement
* the following as
a doubly linked list, as well as a tree.
*/
DataBase d=new
DataBase();
int response;
Scanner keyboard=new
Scanner(System.in);
/* Read the data into
the database from the external disk file here
* IMPORTANT:
duplicate ID numbers should not be added. Disregard
* the entire
record for duplicate IDs
*/
do
{
System.out.println(" 1 Add a new student");
System.out.println(" 2 Delete a student");
System.out.println(" 3 Find a student by ID");
System.out.println(" 4 List students by ID increasing");
System.out.println(" 5 List students by first name
increasing");
System.out.println(" 6 List students by last name
increasing");
System.out.println(" 7 List students by ID decreasing");
System.out.println(" 8 List students by first name
decreasing");
System.out.println(" 9 List students by last name
decreasing");
System.out.println(" ");
System.out.println(" 0 End");
response=keyboard.nextInt();
switch (response)
{
case 1: d.addIt(); //Note: if the user enters an ID
already in use, issue a warning and return to the menu
break;
case 2: d.deleteIt(); //Note: output either "Deleted" or "ID not
Found" and return to menu
break;
case 3: d.findIt(); //Note: output the entire record or
the message "ID not Found" and return to menu
break;
case 4:
d.ListByIDAscending();
break;
case 5: d.ListByFirstAscending();
break;
case 6: d.ListByLastAscending();
break;
case 7: d.ListByIDDescending();
break;
case 8: d.ListByFirstDescending();
break;
case 9: d.ListByLastDescending();
break;
default:
}
} while
(response!=0);
}
}
In: Computer Science
1. List 4 reasons for using formative evaluation during Web design.
2. What is the difference between formative and summative evaluation?
3. Provide any two types formative evaluation and two types of summative evaluation questions.
In: Computer Science
Why is it important for organizations to have a business continuity plan in place?
In: Computer Science
Employees want to be mobile, having the ability to move from their desks to meetings and back again. How do you ensure that the data they are accessing follows the rules for CIA? In a 500- to 750-word essay, develop a plan for securing an enterprise level wireless network, such as the private WGCUSECURE WiFi Network used here on campus. Make sure to address the following: Which wireless security options would you deploy, preventing typical wireless attack vectors? Should you use a layered security approach? Why? Describe the strategy for your design. Include a network diagram. Use Microsoft Visio or online network diagraming tools, as identified in the required readings to visualize your design.
In: Computer Science
How would you use numerical integration to create a classical rodrigues parameter as a function of time in MATLAB?
In: Computer Science
Company XYZ owns a social network web site dedicated for wind surfers. They plan to launch a new online ad delivery and management service web site that will be coupled with their existing social network platform. The online ad management service will enable them to accept online orders for online ads from advertisers. The system will also deliver the ads to the main social network site. The ads will be displayed on the social network site but the content of the ads (the images and/or text objects containing the ad message) will be served by the new web site server. The company forecasts that the web site will receive an average of 10,000 visits from potential or current advertisers and 600 online ad purchase orders per week. They expect to have 30,000 registered online advertisers during the first month of the launch of the web site. Company XYZ dedicate a separate server and database for the new online service. The users of the ad management site and the users of the social network will be managed separately. The data of the two groups will be stored on separate databases. Similarly, web ad management site content and the social network site content will be hosted on separate servers. Company XYZ prefers to manage those two sites separately. The social network site will pull online ads from the database of the online ad management system. The users will experience a seamless presentation of ads within the social network pages without noticing the ads are fed from a different server.
Company XYZ awarded a contract to your company (Company ABC) to develop the web site, web service, and the database that will provide the capability of the online ad delivery and management service. You are the project manager of this project. Your task is to manage a team of three (one graphic designer, one database developer, and one software developer). As the project manager you are required to answer the following questions that provide insight about the project plan.
Explain how the online ads will be stored and served.
In: Computer Science