Need someone to fix my code: based on this version, give me another version without adding struct student.
#include <iostream>
#include <iomanip>
using namespace std;
struct student
{
double firstQuizz;
double secondQuizz;
double midTerm;
double finalTerm;
double overallScore;
char gradeLetter;
string name;
};
void getStudentData(student &s);
void calcPercentage(student &s);
void gradeLetter(student &s);
void display(student s[],int n);
int main()
{
int n;
cout<<"enter the number of students"<<endl;
cin>>n;
struct student students[n];
int i; struct student istudent;
for(i=0;i<n;i++)
{
cout<<":: Student#"<<(i+1)<<"
::"<<endl;
getStudentData(students[i]);
}
for(i=0;i<n;i++)
{
calcPercentage(students[i]);
gradeLetter(students[i]);
}
display(students,n);
return 0;
}
void getStudentData(student &s)
{
cin.ignore();
cout<<"Student name?";
getline(cin,s.name);
cout<<"Enter marks in first quizz :";
cin>>s.firstQuizz;
cout<<"Enter marks in second quizz :";
cin>>s.secondQuizz;
cout<<"Enter marks in mid term :";
cin>>s.midTerm;
cout<<"Enter marks in final term :";
cin>>s.finalTerm;
}
Programming language: C++
void calcPercentage(student &s)
{
double overAllScore = (s.firstQuizz + s.secondQuizz)*5 * 0.25 +
s.midTerm * 0.25 + s.finalTerm* 0.50;
s.overallScore=overAllScore;
}
void gradeLetter(student &s)
{
double average=s.overallScore;
char gradeLetter;
if (average >= 90 && average<=100)
gradeLetter = 'A';
else if (average >= 80 && average < 90)
gradeLetter = 'B';
else if (average >= 70 && average < 80)
gradeLetter = 'C';
else if (average >= 60 && average < 70)
gradeLetter = 'D';
else if (average < 60)
gradeLetter = 'F';
s.gradeLetter=gradeLetter;
}
void display(student s[],int n)
{
//setting the precision to two
decimal places
std::cout << std::setprecision(2) <<
std::fixed;
cout<<setw(15)<<left<<"Name"<<setw(15)<<right<<"Overall
Score"<<setw(15)<<right<<"Grade
Letter"<<endl;
cout<<setw(15)<<left<<"----"<<setw(15)<<right<<"-------------"<<setw(15)<<right<<"------------"<<endl;
for(int i=0;i<n;i++)
{
cout<<setw(15)<<left<<s[i].name<<setw(15)<<right<<s[i].overallScore<<setw(15)<<right<<s[i].gradeLetter<<endl;
}
}
Programming language: C++
Requirement: based on this version, give me another version without adding struct student.
In: Computer Science
use the following codes and change In the main-content div, for content, add three select dropdowns separated by line breaks. One will have ID changeFont, one will have ID bgColor and the third will have ID resizeDiv. For changeFont, the options should be: [CHANGE FONT SIZE] value blank, 8 pt. value 8t, 10 pt. value 10pt, 12 pt. value 12pt, 14 pt. value 14pt, and 16 pt. value 16pt. For bgColor the options should be [CHANGE BG COLOR] value blank, black value #00000, red value #ff0000, green value #00ff00, blue value #0000ff, white value #ffffff. For resizeDiv the options should be [RESIZE MAIN DIV] value blank, 150px value 150px, 250px value 250px, 350px value 350px, 450px value 450px, 550px value 550px, 650px value 650px.
3. Write three functions: changeFont(), changeBGColor(), and resizeDiv(). changeFont will change the font size of the main div based on what the user selects, or the default of 12pt if the user selects [CHANGE FONT SIZE]. changeBGColor will change the background color to the color selected, and ALSO set the font color to white if the selection is black, red, or blue, and font color will be black if white or green. The default for changeBGColor will be white with black font. resizeDiv will resize the main content div to the PX selected, or 85% if nothing is selected. HINT: onchange.
HTML
<head>
<!-- title for web page -->
<title>jen's CISS221 JavaScript Template</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link> is used for external stylesheet -->
<link href="JStemplate.css" rel="stylesheet">
</head>
<body>
<div id="banner" class="banner">Mat's Javascript Template</div>
<div id="left-content" class="left-content">Left content</div>
<div id="main-content" class="main-content">This is Main are</div>
<div id="footer" class="footer">©2019 Mat cantor for CISS 221</div>
</body>
</html>
CSS
/* style rule for body */
body{
background-color: #66ff66;
}
/* style rule for banner */
#banner{
padding-top:20pt;
Padding-bottom:20pt;
color:#141414;
background-color:#cccc33;
text-align: center;
font-size: 18pt;
border: 2px solid green ;
padding: 20px;
}
/* style rule for left-content */
#left-content{
background-color: #000000 ;
text-align: center;
height: 45pt;
Width:50pt;
padding-top: 100pt;
color :#cccc33;
float:left;
border: 2px solid green ;
padding: 65px;
}
/* style rule for main-content */
#main-content{
background-color:#ffffff;
text-align: center;
padding-top:120pt;
Padding-bottom:10pt;
color :#cccc33;
border: 2px solid green;
}
/* style rule for footer */
#footer {
background-color: #cccc33;
text-align: center;
font-size: 8pt;
padding-top:10pt;
Padding-bottom:15pt;
border: 2px solid green ;
padding: 20px;
clear:both
}
In: Computer Science
1. ONLY VISUAL STUDIO C# CONSOLE APPLIACTION
(NO JAVA CODING)
In this part of the assignment, you are required to create a C# Console Application project. The project name should be A3<FirstName><LastName>P1. For example a student with first name John and Last name Smith would name the project A3JohnSmithP1.
You are creating a console based math program. This program will be
shown as a menu with several options. The menu should be created
with a do loop.
The first option is to display a list of even numbers beginning at
0. Once this option is selected, the program asks the user for the
number of even numbers to display. After the user provides this
input, all the values should be displayed at once. This option
should be created using a "for" loop.
The second option is to display a sequence of perfect squares. The
program should begin by printing the square of 1, and ask the user
if they to continue or stop and return to the original menu. If the
user does not want to quit, the next square is printed. This
continues until the user wishes to end the sequence. This option
should be created using a while loop.
The third option is to exit the program. Any invalid option entered
by the user should prompt the menu to reappear and ask the same
three options.
Any numeric entry by the user should not crash if the user enters a
string.
Your program must:
a. Use the appropriate loop for each segment. [3 marks]
b. Encapsulate the logic of options 1 and 2 each within their own
method. [4 marks]
c. The functionality of the menu is correct as described. [3
marks]
d. Proper error handling. [3 marks]
e. Adhere to coding standards as described by the course. Marks
will be taken off wherever coding standards are not followed.
In: Computer Science
Insert the list of elements [11, 14, 16, 4, 7, 2, 23, 28, 19] in this order, into an initially empty AVL tree. Show the details of the insertion process. Note: You must draw a different tree to show the result of each rotation involved. If an insertion requires a double rotation, you must show the result of each rotation separately.
In: Computer Science
Write a program, using functions, to print the lyrics of the song “Old MacDonald.” Your program should print the lyrics for five different animals, similar to the example verse below: Old MacDonald had a farm, Ee-igh, Ee-igh, Oh! And on that farm he had a cow, Ee-igh, Ee-igh, Oh! With a moo, moo here and a moo, moo there. Here a moo, there a moo, everywhere a moo, moo. Old MacDonald had a farm, Ee-igh, Ee-igh, Oh! Include a function that returns multiple values
in python :)
In: Computer Science
This program extends the earlier "Online shopping cart" program. (Consider first saving your earlier program).
(1) Extend the ItemToPurchase class per the following specifications:
Private fields
string itemDescription - Initialized in default constructor to "none"
Parameterized constructor to assign item name, item description, item price, and item quantity (default values of 0). (1 pt)
Public member methods
setDescription() mutator & getDescription() accessor (2 pts)
printItemCost() - Outputs the item name followed by the quantity, price, and subtotal
printItemDescription() - Outputs the item name and description
Ex. of printItemCost() output:
Bottled Water 10 @ $1 = $10
Ex. of printItemDescription() output:
Bottled Water: Deer Park, 12 oz.
(2) Create two new files:
ShoppingCart.java - Class definition
ShoppingCartManager.java - Contains main() method
Build the ShoppingCart class with the following specifications. Note: Some can be method stubs (empty methods) initially, to be completed in later steps.
Private fields
String customerName - Initialized in default constructor to "none"
String currentDate - Initialized in default constructor to "January 1, 2016"
ArrayList cartItems
Default constructor
Parameterized constructor which takes the customer name and date as parameters (1 pt)
Public member methods
getCustomerName() accessor (1 pt)
getDate() accessor (1 pt)
addItem()
Adds an item to cartItems array. Has parameter ItemToPurchase. Does not return anything.
removeItem()
Removes item from cartItems array. Has a string (an item's name) parameter. Does not return anything.
If item name cannot be found, output this message: Item not found in cart. Nothing removed.
modifyItem()
Modifies an item's description, price, and/or quantity. Has parameter ItemToPurchase. Does not return anything.
If item can be found (by name) in cart, check if parameter has default values for description, price, and quantity. If not, modify item in cart.
If item cannot be found (by name) in cart, output this message: Item not found in cart. Nothing modified.
getNumItemsInCart() (2 pts)
Returns quantity of all items in cart. Has no parameters.
getCostOfCart() (2 pts)
Determines and returns the total cost of items in cart. Has no parameters.
printTotal()
Outputs total of objects in cart.
If cart is empty, output this message: SHOPPING CART IS EMPTY
printDescriptions()
Outputs each item's description.
Ex. of printTotal() output:
John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521
Ex. of printDescriptions() output:
John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones
(3) In main(), prompt the user for a customer's name and today's
date. Output the name and date. Create an object of type
ShoppingCart. (1 pt)
Ex.
Enter Customer's Name: John Doe Enter Today's Date: February 1, 2016 Customer Name: John Doe Today's Date: February 1, 2016
(4) Implement the printMenu() method. printMenu() has a
ShoppingCart parameter, and outputs a menu of options to manipulate
the shopping cart. Each option is represented by a single
character. Build and output the menu within the method.
If the an invalid character is entered, continue to prompt for a
valid choice. Hint: Implement Quit before implementing other
options. Call printMenu() in the main() method. Continue to
execute the menu until the user enters q to Quit. (3 pts)
Ex:
MENU a - Add item to cart d - Remove item from cart c - Change item quantity i - Output items' descriptions o - Output shopping cart q - Quit Choose an option:
(5) Implement Output shopping cart menu option. (3 pts)
Ex:
OUTPUT SHOPPING CART John Doe's Shopping Cart - February 1, 2016 Number of Items: 8 Nike Romaleos 2 @ $189 = $378 Chocolate Chips 5 @ $3 = $15 Powerbeats 2 Headphones 1 @ $128 = $128 Total: $521
(6) Implement Output item's description menu option. (2 pts)
Ex.
OUTPUT ITEMS' DESCRIPTIONS John Doe's Shopping Cart - February 1, 2016 Item Descriptions Nike Romaleos: Volt color, Weightlifting shoes Chocolate Chips: Semi-sweet Powerbeats 2 Headphones: Bluetooth headphones
(7) Implement Add item to cart menu option. (3 pts)
Ex:
ADD ITEM TO CART Enter the item name: Nike Romaleos Enter the item description: Volt color, Weightlifting shoes Enter the item price: 189 Enter the item quantity: 2
(8) Implement Remove item menu option. (4 pts)
Ex:
REMOVE ITEM FROM CART Enter name of item to remove: Chocolate Chips
(9) Implement Change item quantity menu option. Hint: Make new
ItemToPurchase object and use ItemToPurchase modifiers before using
modifyItem() method. (5 pts)
Ex:
CHANGE ITEM QUANTITY Enter the item name: Nike Romaleos Enter the new quantity: 3
My starting code for ItemToPurchase is :
public class ItemToPurchase
{
private String itemName;
private int itemPrice;
private int itemQuantity;
public ItemToPurchase()
{
this.itemName = "none";
this.itemPrice = 0;
this.itemQuantity = 0;
}
public ItemToPurchase(String itemName, int itemPrice, int
itemQuantity)
{
this.itemName = itemName;
this.itemPrice = itemPrice;
this.itemQuantity = itemQuantity;
}
public void setName(String itemName)
{
this.itemName = itemName;
}
public String getName()
{
return itemName;
}
public void setPrice(int itemPrice)
{
this.itemPrice = itemPrice;
}
public int getPrice()
{
return itemPrice;
}
public void setQuantity(int itemQuantity)
{
this.itemQuantity = itemQuantity;
}
public int getQuantity()
{
return itemQuantity;
}
}
In: Computer Science
Discuss with examples the importance of ethics in managing and delivering Information Technology projects.
In: Computer Science
JAVA PLEASE
Creating Classes
Create a class that will keep track of a yes/no survey. You will have to store the text (question) of the survey plus the number of yes/no votes. The constructor requires a description of the survey to be passed int (the question). The vote method will simply increment the correct vote count. The toString method will format all of the instance data to be displayed on the screen
In: Computer Science
strlen():
strlen() counts the number of characters in a cstring. The algorithm works by looking at each character in the cstring, counting as it goes. It stops looking at characters when it encounters a null terminator ‘\0’.
Here is my implementation of the strlen() function. You will need to write and test my solution and your own solution.
int profStrLen( char *str ) {
char *endOfStr = str;
while( *endOfStr != '\0' ) {
endOfStr++;
}
return (int)(endOfStr - str);
}
Make sure you understand how my implementation is working before creating your own. Then, you can write your own implementation. For your implementation, do not use pointer arithmetic to solve it - use array notation and a counter instead. Here is the prototype for your function.
int stuStrLen( char * );
strcpy():
strcpy() copies the contents of the second char* into the memory of the first char*. The algorithm works by looking at each character in the second char* and copies that into the first char*. Because we are dealing with cstrings, the copying process will stop when the ‘\0’ is reached in the second char*.
Here’s my implementation. Again, you will need to write and test my solution and your own.
char *profStrCpy( char *str1, char *str2 ) {
char *dest = str1;
while( *str2 != '\0' ) {
*str1 = *str2;
str1++;
str2++;
}
*str1 = ‘\0’;
return dest;
}
Make sure you understand how my implementation is working before creating your own. Then, you can write your own implementation. For your implementation, do not use pointer arithmetic to solve it - use array notation and a counter instead. Here is the prototype for your function.
char *stuStrCpy( char *, char * );
strcat():
strcat() copies the contents of the second char* into the memory of the first char* like strcpy(), but it copies the values in the second char* to the end of the first char*. The algorithm works by looking at each character in the first char* until the ‘\0’ is found. Then, it looks at each character in the second char* and copies that into the first char*’s current location. As it does this, it increments the position in each char* until the ‘\0’ is found in the second char*.
Here’s my implementation. Again, you will need to write and test my solution and your own.
char *profStrCat( char *str1, char *str2 ) {
char *dest = str1;
while( *str1 != '\0' ) {
str1++;
}
while( *str2 != '\0' ) {
*str1 = *str2;
str1++;
str2++;
}
*str1 = ‘\0’;
return dest;
}
Make sure you understand how my implementation is working before creating your own. Then, you can write your own implementation. For your implementation, do not use pointer arithmetic to solve it - use array notation and a counter instead. Here is the prototype for your function.
char *stuStrCat( char *, char * );
Intermediate cstring function
Now that you have worked through many of the cstring functions. I want you to implement the following functions on your own. I will provide an overview of the algorithm, but I will not provide you with an implementation from me. You will need to write and test this function.
strcmp():
strcmp() compares strings lexicographically. It returns a negative value if the first string occurs lexicographically before the second string. It returns a positive value if the first string occurs lexicographically after the second string. And, it returns zero if the two strings are equivalent. Make sure you call attention to the return of strcmp(). The return of zero instead of a non-zero is a common source for errors involved with cstring processing.
The algorithm for strcmp() works by subtracting each character as it iterates through each cstring stopping when the result of the subtraction is nonzero or a ‘\0’ is found in one of the strings. We will return the difference between the two characters.
You will need to write and test your solution. Here is your prototype.
int stuStrCmp( char *, char * );
Everybody likes a mystery
Here is a function of code that is labeled mystery. Type in the code and describe in the comments what the function does algorithmically and tell me what you think the function is named.
int mystery( char *str ) {
char *str2 = str;
long pos;
int result = 0;
while( *str2 != '\0' ) {
str2++;
}
pos = str2 - str - 1;
for( int count = 1; pos >= 0; pos --, count *= 10 ) {
if( str[pos] == ‘-') {
result *= -1;
} else {
result += (str[pos] - '0') * count;
}
}
return result;
}
main.cpp
#include <iostream>
using namespace std;
int profStrLen( char * );
int stuStrLen( char * );
char *profStrCpy( char *, char * );
char *stuStrCpy( char *, char * );
char *profStrCat( char *, char * );
char *stuStrCat( char *, char * );
int stuStrCmp( char *, char * );
int mystery( char * );
int main() {
// type all testing code here
return 0;
}
// implement the functions here
In: Computer Science
##Notice: write in HLA code
.
.
Create an HLA Assembly language program that prompts for a single integer value from the user and prints an boxy pattern like the one shown below. If the number is negative, don't print anything at all.
.
Here are some example program dialogues to guide your efforts:
.
Feed Me: 5
55555
5 5
5 5
5 5
55555
Feed Me: -6
Feed Me: 3
333
3 3
333
.
In an effort to help you focus on building an Assembly program, I’d like to offer you the following C statements matches the program specifications stated above. If you like, use them as the basis for building your Assembly program.
.
SAMPLE C CODE:
------------------------
int i, n, j;
printf( "Feed Me:" );
scanf( "%d", &n );
for (i=1; i<=n; i++) {
if (i == 1 || i == n) { // first or last row
for (j = 1; j <= n; j++) {
printf( "%d", n );
}
printf( "\n" );
}
else { // internal rows of the box
printf( "%d", n );
for (j = 1; j <= n-2; j++) {
printf( " " );
}
printf( "%d", n );
printf( "\n" );
}
}
.
##Answer the questinon in HLA Assembly language program.
In: Computer Science
In the previous question, you designed a simple algorithm to
create a class list application. In this question, you
will implement the same application in Java. To do this, you will
need a working version of a Student ADT, a List
ADT, and the List Iterator. You may start with your own Student
ADT, or you can start from the solutions to
Assignment 2. You will be given a working version of a List
ADT.
Recall that your application does the following:
• Create a class list of students
• Display every Student record in the class list to the
console.
• Give every student a bonus mark on the final exam. It does not
matter how much of a bonus you give.
• Display every Student record in the class list to the console, to
show the changes to the records.
You must store Student objects in a List, using the given List
ADT.
You are to use the List Iterator for any task that requires looking
at every element in a list (the last two items
above).
Here’s a guide for you to help you manage this task.
1. Download the BasicLinkedList.java and List.java files from
Moodle.
2. Obtain the StudentADT.java and Student.java files from either
your solution or the model solution of assignment
3. Create a new application class called ClassListApp.java, that
contains a main method. Make sure that you
include import java.util.*; on the top of the file.
4. Take your design for Exercise 1, and copy it into
ClassListApp.java, as comments. Implement the design in
steps (not all at once). Every time you have a step implemented,
compile and test.
Here are the java source file already given
List.java
import java.util.Iterator;
/**
* Defines the interface to a list collection.
* The implementation of the list is hidden.
*
*/
public interface List<E> extends Iterable<E>
{
/**
Pre:
Post: the list is unchanged.
* Return: true if this list contains no elements; false
otherwise
*/
public boolean isEmpty();
/**
Pre:
Post: the list is unchanged.
* Return: the number of elements in this list.
*/
public int size();
/**
* Check if an element exists in the list
Pre:
Post: the list is unchanged.
Return: true if the specified element is found in this list
and
false otherwise. Throws an EmptyCollectionException if the
list
is empty.
*/
public boolean contains (E targetElement);
/**
Deletes the first element in this list and returns a
reference
to it. Throws an EmptyCollectionException if the list is
empty.
Pre:
Post: the first element is removed from the list
Return: a reference to the removed element
*/
public E deleteHead();
/**
Removes the last element in this list and returns a reference
to it. Throws an EmptyCollectionException if the list is
empty.
Pre:
Post: the last element is removed from the list
Return: a reference to the removed element
*/
public E deleteTail();
/**
Removes the first instance of the specified element from this
list and returns a reference to it. Throws an
EmptyCollectionException
if the list is empty. Throws a ElementNotFoundException if
the
specified element is not found in the list.
Pre: targetElement :: E, the target element to be removed
Post: the element is removed from the list
Return: a reference to the removed element
*/
public E deleteElement(E targetElement);
/**
Insert a new node to the head of the list.
Pre: item :: E, content in the new node
Post: new node is inserted to the head of the list
Return: nothing
*/
public void insertHead(E item);
/**
Insert a new node to the end of the list.
Pre: item :: E, content in the new node
Post: new node is inserted to the end of the list
Return: nothing
*/
public void insertTail(E item);
/**
Insert a new node at a specific position in the list.
Pre: item :: E, content in the new node
position :: the position of the new node
Post: new node is inserted at position in the list
Return: nothing
*/
public void insertAtPosition (E item, int position);
/**
Retrive the element at a specific position in the list.
Pre: position :: Integer, a position in the list
Post: the list is unchanged
Return: the element at the position
*/
public E get(int position);
/**
* Useful method for pretty print for atomic data
Pre:
Post: the list is unchanged.
Return: Returns a string representation of this list.
*/
public String toString();
/**
* Returns an iterator for the elements in this list.
*
* @return an iterator over the elements in this list
*/
public Iterator<E> iterator();
}
Student.java
/**
* Defines the interface to the student ADT.
*
*/
public interface Student {
/**
displayStudentRecord()
Pre:
Post: displays Student info
Return: nothing
*/
public void displayStudentRecord();
/**
Algorithm changeAssignmentGradeForStudent(asnNum,grade)
Pre: asnNum :: Integer, the index of the assignment to grade
grade :: double, the amount to change the grade
Post: If the index is sensible, the appropriate grade is
changed
(this method allows grades to be changed arbitrarily)
Return: true if the change was made, false otherwise
*/
public boolean changeAssignmentGradeForStudent (int asnNum, double
grade);
/**
Algorithm changeExamGradeForStudent(grade)
Pre: grade :: double, the amount to change the grade
Post: the exam grade is changed
(this method allows grades to be changed arbitrarily)
Return: nothing
*/
public void changeExamGradeForStudent(double grade);
}
StudentADT.java
public class StudentADT implements Student {
private String firstName;
private String lastName;
private int stNum;
private double [] agrades;
private double egrade;
/**
Algorithm StudentADT(firstNm, lastNm, stNo, asn1Grade, asn2Grade,
asn3Grade, examGrade)
Constructor to create a student object
Pre: firstNm, lastNm :: String
stNo :: integer
asn1Grade, asn2Grade, asn3Grade :: double
examGrade :: double
Post: allocates memory on the heap for a new Student object
Return: a new Student object, with all fields filled in
*/
public StudentADT(String firstNm, String lastNm, int stNo, double
asn1Grade, double asn2Grade, double asn3Grade, double examGrade){
this.firstName = firstNm;
this.lastName = lastNm;
this.stNum = stNo;
this.agrades = (double[]) new double[3];
this.agrades[0] = asn1Grade;
this.agrades[1] = asn2Grade;
this.agrades[2] = asn3Grade;
this.egrade = examGrade;
}
/**
Algorithm displayStudentRecord()
Pre:
Post: displays Student info
Return: nothing
*/
public void displayStudentRecord() {
System.out.println("Record for " + this.lastName + ", " +
this.firstName + " (" + this.stNum + ") ");
System.out.println("Assignment grades");
for (int i = 0 ; i <= 2; i ++)
System.out.println(this.agrades[i]);
System.out.println("Exam grade: " + this.egrade);
}
/**
Algorithm changeAssignmentGradeForStudent(asnNum,grade)
Pre: asnNum :: Integer, the index of the assignment to grade
grade :: double, the amount to change the grade
Post: If the index is sensible, the appropriate grade is
changed
(this method allows grades to be changed arbitrarily)
Return: true if the change was made, false otherwise
*/
public boolean changeAssignmentGradeForStudent (int asnNum, double
grade) {
if (asnNum < 0 || asnNum > 2)
return false;
else {
this.agrades[asnNum] = this.agrades[asnNum] + grade;
return true;
}
}
/**
Algorithm changeExamGradeForStudent(grade)
Pre: grade :: double, the amount to change the grade
Post: the exam grade is changed
(this method allows grades to be changed arbitrarily)
Return: nothing
*/
public void changeExamGradeForStudent(double grade) {
this.egrade = this.egrade + grade;
}
}
In: Computer Science
In: Computer Science
Write a function named int2ordinal that takes an integer as its only parameter and returns the number with its appropriate suffix as its result (stored in a string). For example, if your function is passed the integer 1 then it should return the string "1st". If it is passed the integer 12 then it should return the string "12th". If it is passed 2003 then it should return the string "2003rd". Your function must not print anything on the screen.
You can use the remainder operator to extract the last digit of an integer by computing the remainder when the integer is divided by 10. Similarly, you can extract the last two digits of an integer by computing the remainder when the integer is divided by 100. For example 29 % 10 is 9 while 1911 % 100 is 11. Then you can construct the string that needs to be returned by your function by converting the integer parameter into a string by calling the str function, and concatenating the appropriate suffix using the + operator.
In: Computer Science
Discuss the two estimation methods of classification-type data mining models while considering ANN as a classifier.
In: Computer Science
Complete a 1- to 2-page table using the template provided comparing your opinion of the rights listed below to a corresponding ethical theory: The right to a higher education The right to private phone conversations The right to health care The right of a presidential/government candidate to receive time on television List one ethical challenge that could impact a U.S. company that wants to acquire a Non-U.S.-based company.
In: Computer Science