In Java create a simple class named student with the following properties:
id
age
gpa
credit hours accomplished
Also, create the following methods:
Constructors
Getters and setters
In: Computer Science
Write a program (polygon.py) that asks the user to enter the number of sides in a regular polygon. For example, an equilateral triangle is a regular 3-sided polygon, a square is a regular 4-sided polygon, and a pentagon is a regular 5-sided polygon. If a user enters a number of sides between 3 and 25, inclusive, draw the polygon and wait for the user to click on the screen to quit the program. If the user enters a number less than 3 or greater than 25, tell them the number of sides must be between 3 and 25, and quit the program
Python.
In: Computer Science
-create a magic 8 ball program in JavaScript
- use a loop to ask for the question
- use a random number to get the answer let
randAnswer=Math.round(Math.round()*10);
- must have at least 10 different answers
-Must use either elseif or switch statement for answer
-must output both answer and user input to console
- the program should repeat indefinitely until either blank input,
or cancel is selected
Bug in jsbin.com
Please don't use HTML thanks
In: Computer Science
What is the foreign key that creates a relationship between the Book and Publisher entities?
In: Computer Science
Write a java code to demonstrate the File IO.
Your code should get the following information from the user.
• Get a file name fname for output
• Get number of data (numbers) (N) you want to process from the user
• Get N numbers from the users through keyboard and store them in an array
• Get M (How many numbers to read from file)
• (Or)You are free to use same N for M (use N for both purposes)
You have to define two methods:
1) To write the numbers from the array into the file fname
2) To read numbers from the file fname, store them in an array, and compute average of the numbers. The method should display the numbers from the array and the average value.
In: Computer Science
Given any positive integer n, the hailstone sequence starting at n is obtained as follows. You write a sequence of numbers, one after another. Start by writing n. If n is even, then the next number is n/2. If n is odd, then the next number is 3n + 1. Continue in this way until you write the number 1.
For example, if you start at 7, then the next number is 22 (3 × 7 + 1). The next number after 22 is 11.
The hailstone sequence starting at 7 is [7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2, 1] and its length is 17.
The hailstone sequence starting at 6 is [6, 3, 10, 5, 16, 8, 4, 2, 1] and its length is 9.
The hailstone sequence starting at 1 is [1] and its length is 1.
The Assignment
Write and test a C++ program that reads a number n from the standard input (after giving a suitable prompt) and then writes the following information on the standard output:
the entire hailstone sequence starting at n, all on one line, with the numbers separated by spaces;
the length of the hailstone sequence that starts with n;
the largest number in the hailstone sequence that starts with n;
an indication of whether the hailstone sequence that starts with n contains a number that is greater than 1000.
the length of the longest hailstone sequence that starts with a number from 1 to n;
the starting number of the longest hailstone sequence that starts with a number from 1 to n;
the largest number that occurs in any hailstone sequence that starts with a number from 1 to n.
the start value, from 1 to n, of the hailstone sequence that contains largest number reported in the previous step.
For this program, use loops. Do not use recursion. Use type int for all of the integers. Do not use any of
The main function must not contain any loops. You can use the <cstdio>, <iostream> and <algorithm> libraries for this assignment.
The output needs to be sensible and easy to read, not just numbers. It must follow the general template below, with all numeric results lined up (approximately) vertically. Each part of the output should be on a separate line. Parts in black are written by the program.
What number shall I start with? 7 The hailstone sequence starting at 7 is: 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 Sequence length: 17 Largest number: 52 Contains a number >1000? no Greatest length starting with 1 to 7: 17 Start value of sequence of length 17: 7 Largest value in a sequence starting with 1 to 7: 52 Start value of sequence containing 52: 7
In: Computer Science
In this program we are going to utilize multiple classes to demonstrate inheritance and polymorphism. We will be creating a base class for our game character. The base class will be LifeForm. We will have derived classes of Human, Dragon, and Unicorn.
LifeForm will have the following attributes:
You will need to provide a default constructor that initializes these attributes as follows:
You will need to provide a getter and setter for each of these variables. When the attribute has a range, the setter method should not allow a value outside that range. For example, if the setHitPoints(points) is called with points = -1, the attribute should NOT be changed. The variables should be private. Please provide a toString method which will return a String containing the values in these variables.
In your Human, Dragon and Unicorn classes you will need variables to hold the character name, weapon, and magic values. Values will be as follow:
|
Weapon |
Magic Amount |
|
|
Human |
Sword or Dagger |
0-50 |
|
Dragon |
Fire or Ice |
0-100 |
|
Unicorn |
Horn or Charm |
100-500 |
You will need to provide getters and setters for each of these private variables. Again, they should not allow values not in the table. You also need to provide a constructor for all of the variables, both the ones in the derived class and the ones in the base class.
Please provide a toString method that returns the type of character, the name, the weapon, the magic amount and the values from base class, call the toString() from the base class.
Create a driver class that allows the user to create a random set of characters. These should be of type Human, Dragon and Unicorn. These should be stored in an ArrayList of LIfeForm. You should prompt the user for entries and create three characters of each class type and store them in the ArrayList. Once you have added the three characters. Print the characters from the ArrayList using your toString methods.
Example output: (Italics indicate user input)
Enter Lifeform 1:
Enter Lifeform Type: human
Enter Lifeform Name: Jon Snow
Enter hit points: 10
Enter strength: 5
Enter weapon: sword
Enter magic: 25
Enter Lifeform 2:
Enter Lifeform Type: unicorn
Enter Lifeform Name: Sparkles
Enter hit points: 0
Enter strength: 18
Enter weapon: charm
Enter magic: 300
Enter Lifeform Type: dragon
Enter Lifeform Name: Smaug
Enter hit points: 0
Enter strength: 18
Enter weapon: ice
Enter magic: 99
The available life forms are: ↵
Lifeform [hitPoints=10, strength=5, type=human]Human [name=jon snow, weapon=sword, magic=25]↵
Lifeform [hitPoints=0, strength=18, type=unicorn]Unicorn [name=sparkles, weapon=charm,magic=300]↵
Lifeform [hitPoints=0, strength=18, type=dragon]Dragon [name=smaug, weapon=ice, magic=99]↵
Grading Criteria (total 100 points):
|
Follows coding standards |
10 |
|
Properly inputs all data |
20 |
|
Properly creates minimum of 4 separate files using inheritance correctly |
20 |
|
Properly creates ArrayList of Lifeform |
15 |
|
Properly uses polymorphism to call toString from the ArrayList |
20 |
|
Outputs are neat and easily read |
15 |
In: Computer Science
Extra Credit (0.5 per)
Here is the link w/country codes:
https://www.iban.com/country-codes
In: Computer Science
Write a Java program for slidsender and slidreiver
1. Start the program
2. Get the frame size from the user
3. To create the frame based on the user
4. To send frames to server from the client
5. If your frames reach the server it will send ACK signal to client otherwise it will send NACK signal to
6. Stop the program
In: Computer Science
You want to test two different web page layouts to see which one performs better (this is known as an A/B test).
In: Computer Science
Complete the attached code so that if the user enters the number 22 for the number of items purchased and 10.98 for the price of each, the following results are displayed:
The total bill is $241.56
Hint: It must include cin and variables.
// This program will read the quantity of an item and its price
// Then print the total price.
// The input will come from the keyboard and the output will go to the monitor.
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int quantity; // number of item purchased
float itemprice; // price of every article
float totalbill; // total account
cout << setprecision(2) << fixed << showpoint;
cout << “please, enter number of items purchased” << endl;
// indicate the instruction to record the amount
// indicate the instruction to ask the price
// indicate the instruction to record the price of each item
// indicate the assignment instruction to determine the total account
// indicate the instruction to show the total on the monitor
return 0;
}
In: Computer Science
write c program to generate 6 numbers to simulate rolling of a dice . use while loop to run 100 and 10000 times. print out how many times it generates 1, 2,3,4,5,6.
In: Computer Science
network security tool- Nmap
• Platform and tools used
• Design of experiments (attack/defense)
• Preliminary tests
• IEEE style report
In: Computer Science
Evaluate possible benefits and drawbacks of using wireless solutions. Propose at least two alternatives for wireless communications in the network
In: Computer Science
How is the emergence of the Internet of Things (IoT) impacting business processes for firms? Give specific examples to illustrate your point(s). Please answer in 2-3 paragraphs
In: Computer Science