For Questions 1-3: consider the following code:
public class A
{
private int number;
protected String name;
public double price;
public A()
{
System.out.println(“A() called”);
}
private void foo1()
{
System.out.println(“A version of foo1() called”);
}
protected int foo2()
{
Sysem.out.println(“A version of foo2() called);
return number;
}
public String foo3()
{
System.out.println(“A version of foo3() called”);
Return “Hi”;
}
}//end class A
public class B extends A
{
private char service;
public B()
{
super();
System.out.println(“B() called”);
}
public void foo1()
{
System.out.println(“B version of foo1() called”);
}
protected int foo2()
{
int n = super.foo2();
System.out.println(“B version of foo2() called”);
return (n+5);
}
public String foo3()
{
String temp = super.foo3();
System.out.println(“B version of foo3()”);
return (temp+” foo3”);
}
}//end class B
public class C extends B
{
public C()
{
super();
System.out.println();
}
public void foo1()
{
System.out.println(“C version of foo1() called”);
}
}//end class C
Assignment
B b1 = new B();
B b3 = new B();
int n = b3.foo2();
//b4 is a B object reference
System.out.println(b4.foo3());
public class N extends String, Integer
{
}
When you compile, you get the following message:
N.java:1: ‘{‘ expected
public class N extends String, Integer
^
1 error
Explain what the problem is and how to fix it.
In: Computer Science
How would you use SAS Enterprise Miner to create a neural network model of your example?
In: Computer Science
Explain the use of neural networking modeling in predictive analytics.
In: Computer Science
There are a large number of tasks involved in information technology and programming, and many of these tasks can be automated using scripting technology. The ability to use scripting correctly will save significant time and leverage available resources in many ways. The first step toward better productivity is to understand how scripting languages work and how they can be used. For this assignment, you will begin to learn the characteristics of scripting languages and gain an understanding of how to select the right scripting tool for a specific task.
In: Computer Science
/* Complete the TO DO comments below */
window.onload = function() {
/* TODO add a border to the header of the page
(a) a simple type selector, and
(b) the style property of the element object. */
document.querySelector('TODO').TODO = TODO;
/* TODO change the text of the h1 element by using
(a) the first-child pseudo selector, and
(b) the innerHTML property of the element object. */
document.querySelector('TODO').TODO = TODO;
/* TODO change the background-color of the section with id
"inventory"
(a) the id selector, and
(b) the style property of the element object. */
document.querySelector('TODO').TODO = TODO;
/* TODO add more of your own changes below! */
}
Please help me
In: Computer Science
How do you represent 5.1 (5 + 1/10) in binary? I know that it is 0101. (point something)
In: Computer Science
Please answer these questions Data Processing and Analysis using python. Thank you
In statistics, an outlier is a data point that differs significantly from other observations. Outliers can cause serious problems in the analysis of data. Please describe one method that can help you detect outliers in a data set.
In: Computer Science
Write a function file that accepts each of the four vectors as inputs. The function file should plot the data on different graphs in the same window. You need to add axis labels and graph titles.
time- 0 5 10 15 20 25 30
A1- 0 7 11 19 15 14 7
A2- 0 10 15 21 16 11 13
A3- 0 9 13 17 22 25 21
In: Computer Science
List the arithmetic operators used in BASIC and state their priorities of execution in a statement. Also give a list and briefly explain the functions of the most popular statements.(IN OWN WORDS MIUST BE)
In: Computer Science
In: Computer Science
JAVASCRIPT:
Please create an array of student names and another array of
student grades.
- Create a function that can put a name and a grade to the
arrays.
- Keep Read student name and grade until student name is “???”. And
save the reading by using a function
- Create another function to show all the grade in that
object.
- Create the third function that can display the maximum grade and
the student’s name.
- Create a sorting function that can sort the arrays based on the
student’s grade.
- Display all the grades and names sorted by the grade.
Please modify the JavaScript code (HTML) below to meet the
requirements, and submit it. Also submit a screenshot of the
output.
<html>
<body>
<script>
//store student name in student array and the grade in grade
array
function spush(slist, name, sgrade, grade){
slist.push(name);//student list
sgrade.push(grade);//grade list
}
//show all the student names and their grades
function showlist(slist, sgrade){
var i;
for (i = 0; i < slist.length; i++){
document.writeln(slist[i] +" "+sgrade[i]+ "<br>");
}
}
function findmax(sgrade){
var i;
var max;
var maxid;
max = sgrade[0];
maxid = 0;
for(i=1;i<sgrade.length; i++){
if(max < sgrade[i]){
max = sgrade[i];
maxid = i;
}}
return maxid;//using index number
}
var stdlist = [];
var sgrade =[];
var mid;
//instead of following, please use prompt for input
spush(stdlist, "John", sgrade, 90);
spush(stdlist, "Tom", sgrade, 95);
spush(stdlist, "Mary", sgrade, 97);
showlist(stdlist, sgrade);
mid = findmax(sgrade);//max grade index number
document.writeln("The maximum grade: "+stdlist[mid]+"
"+sgrade[mid]);
</script>
</body>
</html>
In: Computer Science
locate a recent case of online child pornography. Write a summary of the incident and describe how the incident was discovered, and what criminal outcome occurred to the offender.
In: Computer Science
#Python
5. Write function called evaluate() that evaluates the following Python expressions or assignments as specified:
>>> evaluate()
Enter a number for x: 3
Enter a number for y: 3
Enter a number for z: 4.5
You have entered x = 3 , y = 3 , z = 4.5
Enter what you think the average of x, y, and z is: 3.5
Your average is correct.
The maximum value of x, y, and z = 4.5
The min value of x, y, and z = 3
>>> evaluate()
Enter a number for x: 3
Enter a number for y: 3
Enter a number for z: 4
You have entered x = 3 , y = 3 , z = 4
Enter what you think the average of x, y, and z is: 4.5
Your average is not correct
The correct average is: 3.3333333333333335
The maximum value of x, y, and z = 4
The min value of x, y, and z = 3
In: Computer Science
Cryptography is used heavily in internet communications. True or false?
Explain
In: Computer Science
***Convert the C++ to Python***
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
int charClass;
char lexeme[100];
char str[200];
char nextChar;
const int LETTER = 0;
const int DIGIT = 1;
const int UNKNOWN = -1;
const int OPAREN = 2;
const int CPAREN = 3;
const int PLUS = 4;
const int MINUS = 5;
const int MUL = 6;
const int DIV = 7;
const int ID_CODE = 100;
const int PLUS_CODE = 101;
const int MINUS_CODE = 102;
const int AST_CODE = 103;
const int SLASH_CODE = 104;
const int LEFT_PAREN_CODE = 105;
const int RIGHT_PAREN_CODE = 106;
const int NUM_CODE = 107;
int lexLen;
int nextToken;
int strcnt;
int error = 0;
void addChar();
void getChar();
void getNonBlank();
void lex();
void expr();
void term();
void factor();
void ovalue();
int main()
{
int test;
cout << "Enter an expression: ";
cin >> str;
strcnt=0;
nextChar = str[strcnt++];
lex();
cout << "Call lex /* returns " << nextToken << "
*/\n";
/*****************************************************************************
THIS SEGMENT OF CODE HAS BEEN COMMENTED
OUT
ITS PURPOSE IS TO CONTINUALLY CALL LEX
UNTIL THE INPUT HAS BEEN EXHAUSTED
while (nextChar != '\0')
{
test = lex();
cout << test << endl;
}
END COMMENTED OUT SEGMENT OF CODE
*****************************************************************************/
expr(); /* begin recursive decent parsing */
if (nextChar == '\0')
{
if (error)
cout << "PARSE
FAILED\n\n";
else
cout << "PARSE
SUCCESSFUL\n\n";
}
else
{
cout << "PARSE FAILED\n\n";
}
return 0;
}
/* addChar - a function to add nextChar to lexeme */
void addChar()
{
if (lexLen <= 99)
{
lexeme[lexLen++] = nextChar;
}
else
{
cout << "Error - lexeme is too
long\n";
}
}
/* getChar - a function to get the next character of input and
determine its character class */
void getChar()
{
/* do whatever is required to get the next character from input and
put it in nextChar */
if (isalpha(nextChar))
{
charClass = LETTER;
}
else if (isdigit(nextChar))
{
charClass = DIGIT;
}
else if (nextChar == '(')
{
charClass = OPAREN;
}
else if (nextChar == ')')
{
charClass = CPAREN;
}
else if (nextChar == '+')
{
charClass = PLUS;
}
else if (nextChar == '-')
{
charClass = MINUS;
}
else if (nextChar == '*')
{
charClass = MUL;
}
else if (nextChar == '/')
{
charClass = DIV;
}
else
{
charClass = UNKNOWN;
}
nextChar = str[strcnt++];
}
/* getNonBlank - a function that calles getChar until it returns
a non-whitespace character */
void getNonBlank()
{
while (isspace(nextChar))
{
getChar();
}
}
/* lex - a simple lexical analyzer */
void lex()
{
int retval;
lexLen = 0;
static int first = 1;
/* If it is the first call to lex, initialize by calling getChar
*/
if (first)
{
getChar();
first = 0;
}
getNonBlank();
/* process identifiers */
if (charClass == LETTER)
{
addChar();
getChar();
while ((charClass == LETTER) || (charClass ==
DIGIT))
{
addChar();
getChar();
}
retval = ID_CODE;
}
else if (charClass == DIGIT)
{
addChar();
getChar();
while (charClass == DIGIT)
{
addChar();
getChar();
}
retval = NUM_CODE;
}
else if (charClass == PLUS)
{
getChar();
retval = PLUS_CODE;
}
else if (charClass == MINUS)
{
getChar();
retval = MINUS_CODE;
}
else if (charClass == MUL)
{
getChar();
retval = AST_CODE;
}
else if (charClass == DIV)
{
getChar();
retval = SLASH_CODE;
}
else if (charClass == OPAREN)
{
getChar();
retval = LEFT_PAREN_CODE;
}
else if (charClass == CPAREN)
{
getChar();
retval = RIGHT_PAREN_CODE;
}
else
{
retval = UNKNOWN;
}
nextToken = retval;
}
void expr()
{
cout << "Enter <expr>\n";
term();
while ((nextToken == PLUS_CODE) ||
(nextToken ==
MINUS_CODE))
{
lex();
cout << "Call lex /* returns " <<
nextToken << " */\n";
term();
}
cout << "Exit <expr>\n";
}
void term()
{
cout << "Enter <term>\n";
factor();
while ((nextToken == AST_CODE) ||
(nextToken ==
SLASH_CODE))
{
lex();
cout << "Call lex /* returns " <<
nextToken << " */\n";
factor();
}
cout << "Exit <term>\n";
}
void factor()
{
cout << "Enter <factor>\n";
if (nextToken == ID_CODE)
{
lex();
cout << "Call lex /* returns " <<
nextToken << " */\n";
}
else if (nextToken == LEFT_PAREN_CODE)
{
lex();
cout << "Call lex /* returns " <<
nextToken << " */\n";
expr();
if (nextToken == RIGHT_PAREN_CODE)
{
lex();
cout << "Call lex /* returns "
<< nextToken << " */\n";
}
else
{
error = 1;
}
}
else
{
error = 1;
}
cout << "Exit <factor>\n";
}
void ovalue()
{
if (nextToken == ID_CODE)
cout << lexeme;
else if (nextToken == NUM_CODE)
cout << "Number";
else if (nextToken == PLUS_CODE)
cout << "+";
else if (nextToken == MINUS_CODE)
cout << "-";
else if (nextToken == AST_CODE)
cout << "*";
else if (nextToken == SLASH_CODE)
cout << "/";
else if (nextToken == LEFT_PAREN_CODE)
cout << "(";
else if (nextToken == RIGHT_PAREN_CODE)
cout << ")";
else if (nextToken == UNKNOWN)
cout << "????";
}
In: Computer Science