Questions
CODE IN JAVA Create a class Student includes name, age, mark and necessary methods. Using FileWriter,...

CODE IN JAVA

Create a class Student includes name, age, mark and necessary methods. Using FileWriter, FileReader and BufferedReader to write a program that has functional menu:

Menu

-------------------------------------------------

  1. Add a list of Students and save to File
  2. Loading list of Students from a File
  3. Display the list of Students descending by Name
  4. Display the list of Students descending by Mark
  5. Exit

Your choice: _

+ Save to File: input information of several students and write that information into a text file, each student in a line (use tabs to separate the fields)

+ Read File: read and display information of students

In: Computer Science

JAVA code Create a new class called BetterDiGraph that implements the EditableDiGraph interface See the interface...

JAVA code

Create a new class called BetterDiGraph that implements the EditableDiGraph interface See the interface below for details.

EditableDigraph below:

import java.util.NoSuchElementException;

/**
* Implements an editable graph with sparse vertex support.
*
*
*/
public interface EditableDiGraph {
  
/**
* Adds an edge between two vertices, v and w. If vertices do not exist,
* adds them first.
*
* @param v source vertex
* @param w destination vertex
*/
void addEdge(int v, int w);

/**
* Adds a vertex to the graph. Does not allow duplicate vertices.
*
* @param v vertex number
*/
void addVertex(int v);

/**
* Returns the direct successors of a vertex v.
*
* @param v vertex
* @return successors of v
*/
Iterable getAdj(int v);
  
/**
* Number of edges.
*
* @return edge count
*/
int getEdgeCount();
  
/**
* Returns the in-degree of a vertex.
* @param v vertex
* @return in-degree.
* @throws NoSuchElementException exception thrown if vertex does not exist.
*/
int getIndegree(int v) throws NoSuchElementException;
  
/**
* Returns number of vertices.
* @return vertex count
*/
int getVertexCount();
  
/**
* Removes edge from graph. If vertices do not exist, does not remove edge.
*
* @param v source vertex
* @param w destination vertex
*/
void removeEdge(int v, int w);

/**
* Removes vertex from graph. If vertex does not exist, does not try to
* remove it.
*
* @param v vertex
*/
void removeVertex(int v);

/**
* Returns iterable object containing all vertices in graph.
*
* @return iterable object of vertices
*/
Iterable vertices();

/**
* Returns true if the graph contains at least one vertex.
*
* @return boolean
*/
boolean isEmpty();
  
/**
* Returns true if the graph contains a specific vertex.
*
* @param v vertex
* @return boolean
*/
boolean containsVertex(int v);
}

In: Computer Science

An ALP to print only lowercase alphabets[A-Z] using emu8086 and the code will be written like...

An ALP to print only lowercase alphabets[A-Z] using emu8086 and the code will be written like this form EX:

MOV AX, @DATA ; initialize

DS MOV DS, AX

and please write explanation when writing the code so we can understand it

In: Computer Science

****JAVA Program**** Make a LandTract class with the following fields: • length - an int containing...

****JAVA Program****

Make a LandTract class with the following fields:

• length - an int containing the tract's length
• width - an int containing the tract's width

The class should also have the following methods :

• area - returns an int representing the tract's area
• equals - takes another LandTract object as a parameter and returns a boolean saying
whether or not the two tracts have the same dimensions (This applies regardless of whether the dimensions match up. i.e., if the length of the first is the same as the width of the other and vice versa, that counts as having equal dimensions.)
• toString - returns a String with details about the LandTract object in the format:
LandTract object with length 30 and width 40
(If, for example, the LandTract object had a length of 30 and a width of 40.)

Write a separate program that asks the user to enter the dimensions for the two tracts of
land (in the order length of the first, width of the first, length of the second, width of the second). The program should print the output of two tracts' toString methods followed by a sentence stating whether or not the tracts have equal dimensions. (If the tracts have the same dimensions, print, "The two tracts have the same size." Otherwise, print, "The two tracts do not have the same size.") Print all three statements on separate lines.

****Results have to look like this****

Enter·length·of·first·land·tract:10↵
Enter·width·of·first·land·tract:55↵
Enter·length·of·second·land·tract:36↵
Enter·width·of·second·land·tract:75↵
LandTract·with·length·10,·width·55,·and·area·550↵
LandTract·with·length·36,·width·75,·and·area·2700↵
The·two·tracts·do·not·have·the·same·size.↵

In: Computer Science

a) Write down the attributes of three computer hardware input devices. Discuss the form of interaction...

a) Write down the attributes of three computer hardware input devices. Discuss
the form of interaction each supports in a computer system.


b) With your knowledge in variations in physical abilities and physical workplaces,
what four practical guidelines would you adapt in your workplace? Explain the
reasons for your choice.

c) Explain the main concerns of Human Computer Interaction

In: Computer Science

Some information about youTube. Summarize to an Infographic. Focus on numbers, statistics, success stories, advantages, benefits,...

Some information about youTube.

Summarize to an Infographic. Focus on numbers, statistics, success stories, advantages, benefits, etc for youTube.

In: Computer Science

The charging min value is zero and max value is 100. When the charger is not...

The charging min value is zero and max value is 100. When the charger is not plugged, the robot is in discharging state and the battery decreases. When charger is attached, the state is changed to charging and the value increase. Once it reaches the max
limit, the state changes to battery full.

Q) Write boundary value analysis for battery level.

Q) Write test cases for battery level for both valid and invalid.

In: Computer Science

1. Servlet program to find the information about an account holder at a bank. ( Bank...

1. Servlet program to find the information about an account holder at a bank.
( Bank name= your name )
(I'm using netbeans with glassfish, lecturer mentioned not to use jsp, mostly use CSS, Javascript, html, xml)
• Case:
a) Have username and password authentication
b) Display his Account balance to be RM10000,
c) Show different functionalities of a bank account (Deposit, Withdrawal, Print)
d) For every transaction make sure make use of his account balance.
e) Perform the functionalities(Deposit, Withdraw and print) until the user selects
to stop.

In: Computer Science

– Consider an XYZ Hypermarket in the Sultanate of Oman. The hypermarket has got a lot...

– Consider an XYZ Hypermarket in the Sultanate of Oman. The hypermarket has got a lot of branches spread across different Wilayats in the country. As a database administrator, which client server architecture will you be preferring for this hypermarket and why. Support you answer with valid in-text citations and references.

In: Computer Science

In order to implement a DNS amplification attack, the attacker must trigger the creation of a...

  1. In order to implement a DNS amplification attack, the attacker must trigger the creation of a sufficiently large volume of DNS response packets from the intermediary to exceed the capacity of the link to the target organization. Consider an attack where the DNS response packets are 1000 bytes in size (ignoring framing overhead).

    1. How many of these packets per second must the attacker trigger to flood a target organization using a 30-Mbps link? A 100-Mbps link? Or a 1-Gbps link?

    2. If the DNS request packet to the intermediary is 60 bytes in size, how much bandwidth does the attacker consume to send the necessary rate of DNS request packets for each of these three cases?

In: Computer Science

Q17. Fill in the blanks: Consider the operands to be signed words (16 bit) a) mov...

Q17. Fill in the blanks:

Consider the operands to be signed words (16 bit)

a) mov ax, - 48 cwd mov bx , 5 idiv bx ; ax = _______ , dx = _____ (provide answers in decimal) Consider the operands to be signed words (16 bit)

b) mov ax , -1 mov bx , -1 imul bx ; ax = _________H, dx =__________H (provide answer in Hex) Consider the operands to be signed words

c) mov ax , -1 mov dx , 2 imul dx ; ax = _______H ,dx = ________H(provide answer in Hex) Consider the operands to be signed byte (8 bit)

d) mov al, -48 cbw mov bl, 5 idiv bl ; al = _____, ah = _______ (provide answers in decimal) 5

Q18. Fill in the values as the following code fragment is executed:

a) count DB 9A H ; count is Byte variable initialized to 9A H num DB BC H ; num is a Byte variable initialized to BCH mov ah, count mov al, num ; ax = _______________H

b) mov ax, 1234H mov ax, ‘A’ ; ax = ________________H (Hint: ASCII code of ‘A’ = 65 in decimal)

c ) mov dx , 0087H mov ax, 6000H mov bx, 100H div bx ; ax = ________________H

d) mov ax, 1237H sub al, 38H ; ax = ________________H

In: Computer Science

Provide an example of a real-time application and, to the best of your knowledge, discuss its...

Provide an example of a real-time application and, to the best of your knowledge, discuss its following aspects:

What would be the involved periodic tasks? What would be their release time (or release-time jitter)?

What would be the aperiodic tasks in the application? What would be their release time, i.e., events that would trigger the aperiodic tasks?

What would be the sporadic tasks in the application?

What would be their release time, i.e., events that would trigger the aperiodic tasks?

In: Computer Science

There's an array named score, 90, 98, 92, 88, 100, 80 are the elements in this...

There's an array named score, 90, 98, 92, 88, 100, 80 are the elements in this array.

Please write a Java program to declare and sort this array (use selection sort).

In: Computer Science

I need the java code for a 4 function calculator app on android studio (do this...

I need the java code for a 4 function calculator app on android studio (do this on android studio) -

The requirements are the following :

- The only buttons needed are 0-9, *, /, +, -, a clear, and enter button

- Implement the onclicklistener on the main activity

- The calcuator should use order of operations (PEMDAS)

- It should be able to continue from a previous answer (Ex: If you type 2+6 the calculator will display 8. If you then multiple by 2 the current result will simply be multiplied by 2)

- It should read the entire sequence of numbers and operators and save them into a String. The information can be read out of the String using a StringTokenizer. The delimiters will be the operators on the calculator.

- The entire mathematical expression will be displayed on the screen before the equal button is clicked.

- The equation will simply be evaluated in the order that the user types in the numbers rather than the precedence

- If the user enters an equation with invalid syntax, the output should display “error”. The calculator should also display “error” for any mathematical calculations that are impossible.

In: Computer Science

1 import java.util.Random; 2 3 /* This class ecapsulates the state and logic required to play...

1 import java.util.Random;
2
3 /* This class ecapsulates the state and logic required to play the
4 Stick, Water, Fire game. The game is played between a user and the computer.
5 A user enters their choice, either S for stick, F for fire, W for water, and
6 the computer generates one of these choices at random- all equally likely.
7 The two choices are evaluated according to the rules of the game and the winner
8 is declared.
9
10 Rules of the game:
11 S beats W
12 W beats F
13 F beats S
14 no winner on a tie.
15
16 Each round is executed by the playRound method. In addition to generating the computer
17 choice and evaluating the two choices, this class also keeps track of the user and computer
18 scores, the number of wins, and the total number of rounds that have been played. In the case
19 of a tie, neither score is updated, but the number of rounds is incremented.
20
21 NOTE: Do not modify any of the code that is provided in the starter project. Additional instance variables and methods
22 are not required to make the program work correctly, but you may add them if you wish as long as
23 you fulfill the project requirements.
24
25 */
26 public class StickWaterFireGame {
27
28
29 // TODO 1: Declare private instance variables here:
30
31
32 /* This constructor assigns the member Random variable, rand, to
33 * a new, unseeded Random object.
34 * It also initializes the instance variables to their default values:
35 * rounds, player and computer scores will be 0, the playerWins and isTie
36 * variables should be set to false.
37 */
38 public StickWaterFireGame() {
39 // TODO 2: Implement this method.
40
41 }
42
43 /* This constructor assigns the member Random variable, rand, to
44 * a new Random object using the seed passed in.
45 * It also initializes the instance variables to their default values:
46 * rounds, player and computer scores will be 0, the playerWins and isTie
47 * variables should be set to false.
48 */
49 public StickWaterFireGame(int seed) {
50 // TODO 3: Implement this method.
51
52 }
53
54 /* This method returns true if the inputStr passed in is
55 * either "S", "W", or "F", false otherwise.
56 * Note that the input can be upper or lower case.
57 */
58 public boolean isValidInput(String inputStr) {
59 // TODO 4: Implement this method.
60 return false;
61 }
62
63 /* This method carries out a single round of play of the SWF game.
64 * It calls the isValidInput method and the getRandomChoice method.
65 * It implements the rules of the game and updates the instance variables
66 * according to those rules.
67 */
68 public void playRound(String playerChoice) {
69 // TODO 12: Implement this method.
70 }
71
72 // Returns the choice of the computer for the most recent round of play
73 public String getComputerChoice(){
74 // TODO 5: Implement this method.
75 return null;
76 }
77
78 // Returns true if the player has won the last round, false otherwise.
79 public boolean playerWins(){
80 // TODO 6: Implement this method.
81 return false;
82 }
83
84 // Returns the player's cumulative score.
85 public int getPlayerScore(){
86 // TODO 7: Implement this method.
87 return 0;
88 }
89
90 // Returns the computer's cumulative score.
91 public int getComputerScore(){
92 // TODO 8: Implement this method.
93 return 0;
94 }
95
96 // Returns the total nuber of rounds played.
97 public int getNumRounds(){
98 // TODO 9: Implement this method.
99 return 0;
100 }
101
102 // Returns true if the player and computer have the same score on the last round, false otherwise.
103 public boolean isTie(){
104 // TODO 10: Implement this method.
105 return false;
106 }
107
108 /* This "helper" method uses the instance variable of Random to generate an integer
109 * which it then maps to a String: "S", "W", "F", which is returned.
110 * This method is called by the playRound method.
111 */
112 private String getRandomChoice() {
113 // TODO 11: Implement this method.
114 return null;
115 }
116 }
117

In: Computer Science