Questions
How to create a JS application using the code below that displays the lists of grades...

How to create a JS application using the code below that displays the lists of grades in their corresponding letter grade textbox and each grade being sorted from lowest to highest.

<!DOCTYPE>
<html>
<head>
<title>EXAM01_03</title>
<style type="text/css">
form{color:black;background-color:lightgray;border:6px solid black;border-width:4px;width:450px;margin:1px;padding:1px;}
#ans1,#ans2,#ans3,#ans4,#ans5,#numbers{background-color:white;border:4px solid black;}
input[type="button"]{color:black;background-color:red;border:4px solid black;}
input[type="text"]{margin:2px;}
div.title{color:white;background-color:black;float: left; width: 450px; text-align:center;}
</style>
</head>
<body>
   <form>
   <div class="title"><label>EXAM01_03</label></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>Enter Grade List:</label></div><div style="float:left;"><input type="text" id="numbers" /></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>A:</label></div><div style="float:left;"><input type="text" id="ans1" /></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>B:</label></div><div style="float:left;"><input type="text" id="ans2" /></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>C:</label></div><div style="float:left;"><input type="text" id="ans3" /></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>D:</label></div><div style="float:left;"><input type="text" id="ans4" /></div>
   <p style="clear:both;" />
   <div style="float:left;width:150px;"><label>F:</label></div><div style="float:left;"><input type="text" id="ans5" /></div>
   <p style="clear:both;" />
   <div style="text-align:center;">
   <input type="button" value="Enter" />
   <input type="button" value="Clear"    />
   </div>
   </form>
</body>
</html>

In: Computer Science

Implement function noVowel() that takes a string s as input and returns True if no char-...

Implement function noVowel() that takes a string s as input and returns True if no char- acter in s is a vowel, and False otherwise (i.e., some character in s is a vowel). >>> noVowel('crypt') True >>> noVowel('cwm') True >>> noVowel('car') False

Implement function allEven() that takes a list of integers and returns True if all integers in the list are even, and False otherwise.

>>> allEven([8, 0, -2, 4, -6, 10])

True

>>> allEven([8, 0, -1, 4, -6, 10])

False

In: Computer Science

I am using MIPS assembly with MARS. My question is about I/O Devices. 1) Research and...

I am using MIPS assembly with MARS. My question is about I/O Devices.

1) Research and read about SFRs. Explain the differences between TRISx, PORTx, LATx and ODCx ports. Specify the special function registers (SFRs) for the I/O device(s)

In: Computer Science

Evaluate the following ARM code line by line and show the state of each register and...

Evaluate the following ARM code line by line and show the state of each register and PC after execution.

Initial state: X1 = 0, X2 = 0, X3 = 0, X4 = 0x7, X5 = 0

If there are multiple values for a given register at a particular instruction list them in order

X1

X2

X3

X4

X5

PC after execution

0x100

ADDI  X1,X1,#4096

0x104

B #8

0x108

ADDI X3,X3,#1

0x10C

CBNZ X3, #2

0x110

CBZ  X2, #2

0x114

B #-1

0x118

AND X5,X3,X4

0x11C

XOR X5,X3,X4

0x120

ORR X2,X3,X4

0x124

CBZ X2, #7

0x128

BREAK

In: Computer Science

Write a pseudocode method to determine if a set of parentheses and brackets is balanced. For...

Write a pseudocode method to determine if a set of parentheses and brackets is balanced. For example, such a method should return true for the string, "[()]{}{[()()]()}" and false for the string "[(])". Discuss how the algorithm will perform and how much space in memory it will take if somebody passes a massive string as input.

In: Computer Science

IM GETTING A ERROR MESSAGE : if rentalCode == 'W' and averageMiles <= 900: mileCharge =...

IM GETTING A ERROR MESSAGE :

if rentalCode == 'W' and averageMiles <= 900:
mileCharge = weeksRented * 100.00
else:

Collect Customer Data - Part 2

  1. Collect Mileage information:

    Prompt: "Starting Odometer Reading:\n"

    Variable: odoStart = ?

    Prompt: "Ending Odometer Reading:\n"

    Variable: odoEnd = ?

    Add code to PRINT odoStart and odoEnd variables as well as the totalMiles to check your work.

    The following data will be used as input in the test:

    odoStart = 1234
    odoEnd = 2222
    

    Collect Customer Data - Part 2 - Feedback Link

    IF you would like some constructive feedback on your assignment before you submit for a grade, press the Help Me! button below.

    Help Me!

    Customer Data Check 2

    In your rental_car.py file, add code to print out the two new variables you have collected input for:
    odoStart
    odoEnd
    totalMiles

    1. Prompt the user to input the starting odometer reading (expect type int from the user)
    2. Prompt the user to input the ending odometer reading (expect type int from the user)
      1. Test your code.
      2. import sys
        '''
        Section 1: Collect customer input
        '''
        #Add customer input 1 here, rentalCode = ?
        rentalCode = input("(B)udget, (D)aily, or (W)eekly rental?\n")
        print (rentalCode)
        #Collect Customer Data - Part 2

        #4)Collect Mileage information:
        #a)   Prompt the user to input the starting odometer reading and store it as the variable odoStart

        #Prompt -->"Starting Odometer Reading:\n"
        # odoStart = ?
        odoStart = input('Starting Odometer Reading: ')
        #b)   Prompt the user to input the ending odometer reading and store it as the variable odoEnd

        #Prompt -->"Ending Odometer Reading:"
        # odoEnd = ?
        odoEnd = input('Ending Odometer Reading: ')
        #c) Calculate total miles
        totalMiles = int(odoEnd) - int(odoStart)
        #Print odoStart, odoEnd and totalMiles
        print (odoStart)
        print (odoEnd)
        print (totalMiles)

        # Calculate Charges 2

        ##   Calculate the mileage charge and store it as
        # the variable mileCharge:

        #a)   Code 'B' (budget) mileage charge: $0.25 for each mile driven
        if rentalCode == "B":
        mileCharge = totalMiles * 0.25
        #b)   Code 'D' (daily) mileage charge: no charge if the average
        # number of miles driven per day is 100 miles or less;
        # i)   Calculate the averageDayMiles (totalMiles/rentalPeriod)
        elif rentalCode == "D":
        averageDayMiles = totalMiles/rentalPeriod
        if averageDayMiles <= 100:
        extraMiles == 0
        # ii)   If averageDayMiles is above the 100 mile per day
        # limit:
        # (1)   calculate extraMiles (averageDayMiles - 100)
        if totalMiles >= 100 and rentalCode == 'D':
        # (2)   mileCharge is the charge for extraMiles,
        mileCharge = totalMiles * int(rentalPeriod) *0.25   
        #c)   Code 'W' (weekly) mileage charge: no charge if the
        # average number of miles driven per week is
        # 900 miles or less;
        if rentalCode == 'W' and averageMiles <= 900:
        mileCharge = weeksRented * 100.00
        else:
        mileCharge = 0
        # i)   Calculate the averageWeekMiles (totalMiles/ rentalPeriod)
        # ii)   mileCharge is $100.00 per week if the average number of miles driven per week exceeds 900 miles
        if rentalCode == 'W' and averageMiles >= 900:
        mileCharge = weeksRented * 100.00
        else:
        print('Charges : ${}'.format(mileCharge))

In: Computer Science

Write a class that maintains the scores for a game application. Implement the addition and removal...

Write a class that maintains the scores for a game application. Implement the addition and removal function to update the database. The gamescore.txt contains player’ name and score data record fields separated by comma. For Removal function, uses the name field to select record to remove the game score record.

Use the List.java, LList.java, Dlink.java, GameEntry.java and gamescore.txt found below

Read gamescore.txt to initialize the Linked list in sorted order by score.

Provide Remove and Add function for user to update the sorted linked list.

Display “Name exist” when add an exist name to the list.

Display “Name does not exist” when remove a name not on the list.

List.java File:

/** Source code example for "A Practical Introduction to Data

Structures and Algorithm Analysis, 3rd Edition (Java)"

by Clifford A. Shaffer

Copyright 2008-2011 by Clifford A. Shaffer

*/

/** List ADT */

public interface List<E>

{

/**

* Remove all contents from the list, so it is once again empty. Client is

* responsible for reclaiming storage used by the list elements.

*/

public void clear();

/**

* Insert an element at the current location. The client must ensure that

* the list's capacity is not exceeded.

*

* @param item

* The element to be inserted.

*/

public void insert(E item);

/**

* Append an element at the end of the list. The client must ensure that

* the list's capacity is not exceeded.

*

* @param item

* The element to be appended.

*/

public void append(E item);

/**

* Remove and return the current element.

*

* @return The element that was removed.

*/

public E remove();

/** Set the current position to the start of the list */

public void moveToStart();

/** Set the current position to the end of the list */

public void moveToEnd();

/**

* Move the current position one step left. No change if already at

* beginning.

*/

public void prev();

/**

* Move the current position one step right. No change if already at end.

*/

public void next();

/** @return The number of elements in the list. */

public int length();

/** @return The position of the current element. */

public int currPos();

/**

* Set current position.

*

* @param pos

* The position to make current.

*/

public void moveToPos(int pos);

/** @return The current element. */

public E getValue();

}

LList.java File:

/**

* Source code example for "A Practical Introduction to Data Structures and

* Algorithm Analysis, 3rd Edition (Java)" by Clifford A. Shaffer Copyright

* 2008-2011 by Clifford A. Shaffer

*/

// Doubly linked list implementation

class LList<E> implements List<E>

{

private DLink<E> head; // Pointer to list header

private DLink<E> tail; // Pointer to last element in list

protected DLink<E> curr; // Pointer ahead of current element

int cnt; // Size of list

// Constructors

LList(int size)

{

this();

} // Ignore size

LList()

{

curr = head = new DLink<E>(null, null); // Create header node

tail = new DLink<E>(head, null);

head.setNext(tail);

cnt = 0;

}

public void clear()

{ // Remove all elements from list

head.setNext(null); // Drop access to rest of links

curr = head = new DLink<E>(null, null); // Create header node

tail = new DLink<E>(head, null);

head.setNext(tail);

cnt = 0;

}

public void moveToStart() // Set curr at list start

{

curr = head;

}

public void moveToEnd() // Set curr at list end

{

curr = tail.prev();

}

/** Insert "it" at current position */

public void insert(E it)

{

curr.setNext(new DLink<E>(it, curr, curr.next()));

curr.next().next().setPrev(curr.next());

cnt++;

}

/** Append "it" to list */

public void append(E it)

{

tail.setPrev(new DLink<E>(it, tail.prev(), tail));

tail.prev().prev().setNext(tail.prev());

cnt++;

}

/** Remove and return current element */

public E remove()

{

if (curr.next() == tail)

return null; // Nothing to remove

E it = curr.next().element(); // Remember value

curr.next().next().setPrev(curr);

curr.setNext(curr.next().next()); // Remove from list

cnt--; // Decrement the count

return it; // Return value removed

}

/** Move curr one step left; no change if at front */

public void prev()

{

if (curr != head) // Can't back up from list head

curr = curr.prev();

}

// Move curr one step right; no change if at end

public void next()

{

if (curr != tail.prev())

curr = curr.next();

}

public int length()

{

return cnt;

}

// Return the position of the current element

public int currPos()

{

DLink<E> temp = head;

int i;

for (i = 0; curr != temp; i++)

temp = temp.next();

return i;

}

// Move down list to "pos" position

public void moveToPos(int pos)

{

assert (pos >= 0) && (pos <= cnt) : "Position out of range";

curr = head;

for (int i = 0; i < pos; i++)

curr = curr.next();

}

public E getValue()

{

// Return current element

if (curr.next() == tail)

return null;

return curr.next().element();

}

// reverseList() method that reverses the LList

public void reverseList()

{

LList<E> revList = new LList<E>();

curr = tail.prev();

while (curr != head)

{

revList.append(curr.element());

curr = curr.prev();

}

head.setNext(revList.head.next());

}

// Extra stuff not printed in the book.

/**

* Generate a human-readable representation of this list's contents that

* looks something like this: < 1 2 3 | 4 5 6 >. The vertical bar

* represents the current location of the fence. This method uses

* toString() on the individual elements.

*

* @return The string representation of this list

*/

public String toString()

{

// Save the current position of the list

int oldPos = currPos();

int length = length();

StringBuffer out = new StringBuffer((length() + 1) * 4);

moveToStart();

out.append("< ");

for (int i = 0; i < oldPos; i++)

{

if (getValue() != null)

{

out.append(getValue());

out.append(" ");

}

next();

}

out.append("| ");

for (int i = oldPos; i < length; i++)

{

out.append(getValue());

out.append(" ");

next();

}

out.append(">");

moveToPos(oldPos); // Reset the fence to its original position

return out.toString();

}

}

DLink.java File:

/** Source code example for "A Practical Introduction to Data

Structures and Algorithm Analysis, 3rd Edition (Java)"

by Clifford A. Shaffer

Copyright 2008-2011 by Clifford A. Shaffer

*/

/** Doubly linked list node */

class DLink<E>

{

private E element; // Value for this node

private DLink<E> next; // Pointer to next node in list

private DLink<E> prev; // Pointer to previous node

/** Constructors */

DLink(E it, DLink<E> p, DLink<E> n)

{

element = it;

prev = p;

next = n;

}

DLink(DLink<E> p, DLink<E> n)

{

prev = p;

next = n;

}

/** Get and set methods for the data members */

DLink<E> next()

{

return next;

}

DLink<E> setNext(DLink<E> nextval)

{

return next = nextval;

}

DLink<E> prev()

{

return prev;

}

DLink<E> setPrev(DLink<E> prevval)

{

return prev = prevval;

}

E element()

{

return element;

}

E setElement(E it)

{

return element = it;

}

}

GameEntry.java File:

public class GameEntry {
protected String name;
protected int score;

public GameEntry(String n, int s) {
name = n;
score = s;
}

public String getName() {return name;}

public int getScore() {return score;}

public String toString() {
return "("+name+","+score+")";
}

}

gamescore.txt File:

Mike,1105
Rob,750
Paul,720
Anna,660
Rose,590
Jack,510

In: Computer Science

what is the output? int main ( ) { int a = 3, b= 2, c=...

what is the output?

int main ( )

{

int a = 3, b= 2, c= 1, d, e, f, g;

d = a&b;    e = a | c; f = a >> 1, g = a << 1;

cout << “d= “ << d << “ e = “ << e << “ f = “ << f << “g = “ << g << endl;

}

In: Computer Science

Assignment 2 is on page 146, question 12. The assignment asks you to write a program...

Assignment 2 is on page 146, question 12. The assignment asks you to write a program to allow a user to enter a temperature in Celsius and convert it to Fahrenheit. Then display the new temperature on the screen. Consider using the fixed, showpoint, and setprecision stream manipulators with your output. (hint, probably points to what sort of numeric variables you should use) The formula to convert from C to F is in the book on page 146.

For extra credit, have your program then ask for the temperature in Fahrenheit and convert to Celsius and display in a similar manner.

In: Computer Science

Looking for some more simple pseudocode (examples in bold italicized font below) for this chunk of...

Looking for some more simple pseudocode (examples in bold italicized font below) for this chunk of program? I have added some, but my professor prefers more than this, thank you and THUMBS UP always left for good answers!

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

       VectorStack<Integer> lowerValues = new VectorStack<Integer>();

       VectorStack<Integer> upperValues = new VectorStack<Integer>();

       for (int i = 0; i < data.length; i++)

       {

           lowerValues.push(data[i]);

       }
// While the lower values are not empty
       while (!lowerValues.isEmpty()) {

           temp = lowerValues.pop();

           while ((!upperValues.isEmpty() && temp < upperValues.peek()))

           {

               lowerValues.push(upperValues.pop());

// Push the pop of upper value

           }

           upperValues.push(temp);

       }

       while (!upperValues.isEmpty()) {

           for (int b = 0; b < data.length; b++) {

               result[b] = upperValues.pop();

               System.out.println(result[b]);

           }

       }

       return result;

   }

In: Computer Science

Can you make links out of lists where each item in a list is its own...

Can you make links out of lists where each item in a list is its own link? How might you accomplish this? expalin how you can do it with a example.

In: Computer Science

IT Project Management: Ch4 1) How are potential projects identified? 2) What are the methods for...

IT Project Management: Ch4

1) How are potential projects identified?

2) What are the methods for categorizing Information Technology projects?

In: Computer Science

Given a monotonically increasing function f(n) (where ‘n’ is an integer), use a binary search algorithm...

Given a monotonically increasing function f(n) (where ‘n’ is an integer), use a binary search algorithm to find the largest value of ‘n’ for which f(n) is less than a target. Show all the work (including the values for the left index, right index, middle index and the function value at the middle index) for each iteration as well as write down the initial values of the left index and right index and the corresponding function values.

f(n) = 3n^3 + 5n + 1, Target = 100

In: Computer Science

Question 1 Refer to the operations below: Add (10 + 5) Add (4+8) Add (7*2) Add...

Question 1
Refer to the operations below:
Add (10 + 5)
Add (4+8)
Add (7*2)
Add (90 – 3)
Print list
Print peek
Remove an item from the list
Print list
1.1 Implement the operations above into a Queue structure called q1.
1.2 Implement the operations above into a Stack structure called s1.

Name your program Question1_1 for the queue structure and Question1_2 for the stack structure

JAVA Language to be used.

Please give step by step explanation on how to save and run the programs

In: Computer Science

On Android Studio, create a 4 function calculator. The only buttons you need are 0-9, *,...

On Android Studio, create a 4 function calculator. The only buttons you need are 0-9, *, /, +, -, a clear, and enter button. Having this java code below, I need the XML code that organizes the layout of the calculator (using either linearLayout or relativeLayout). As shown in the JAVA Code - Button button0, button1, button2, button3, button4, button5, button6, button7, button8, button9, buttonadd, buttonsubtract, buttonmultiply, buttondivide, buttonequals, buttonclear and TextView display - is what is needed in the XML layout for this calculator.

JAVA CODE -

package com.example.10012698.calculatorproject;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.StringTokenizer;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {

Button button0, button1, button2, button3, button4, button5, button6,
button7, button8, button9, buttonadd, buttonsubtract, buttonmultiply,
buttondivide, buttonequals, buttonclear;
TextView display;
String displaytext="";
double result;
double x, y;
ArrayList<String> list;


@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

button0 = (Button) findViewById(R.id.button0);
button1 = (Button) findViewById(R.id.button1);
button2 = (Button) findViewById(R.id.button2);
button3 = (Button) findViewById(R.id.button3);
button4 = (Button) findViewById(R.id.button4);
button5 = (Button) findViewById(R.id.button5);
button6 = (Button) findViewById(R.id.button6);
button7 = (Button) findViewById(R.id.button7);
button8 = (Button) findViewById(R.id.button8);
button9 = (Button) findViewById(R.id.button9);
buttonadd = (Button) findViewById(R.id.buttonadd);
buttonsubtract = (Button) findViewById(R.id.buttonsubtract);
buttonmultiply = (Button) findViewById(R.id.buttonmultiply);
buttondivide = (Button) findViewById(R.id.buttondivide);
buttonclear = (Button) findViewById(R.id.buttonclear);
buttonequals = (Button) findViewById(R.id.buttonequals);
display = (TextView) findViewById(R.id.display);
display.setOnClickListener(this);
list = new ArrayList<>();
}

public void onClick(View view)
{
if(!(view.equals(buttonclear)&&!(view.equals(buttonequals))))
{
display.setText(display.getText()+""+((Button)view).getText());

if(displaytext.equals("0"))
{
display.setText(" ");
}

if(view.equals(buttonclear))
{
display.setText(" ");
}

if(view.equals(buttonequals))
{
displaytext= displaytext.substring(0,displaytext.length()-1);
StringTokenizer operators= new StringTokenizer(displaytext, "+-*/",true);

while(operators.hasMoreTokens())
{
list.add(operators.nextToken());
}

for(int j=0; j<list.size()-1; j++)
{
if (list.get(j).equals("*") || list.get(j).equals("/"))
{
x = Double.parseDouble(list.get(j - 1));
y = Double.parseDouble(list.get(j + 1));

if (list.get(j).equals("*"))
{
result+=(x*y);
}

if (list.get(j).equals("/"))
{
result+=(x/y);
}
}
}
for(int k=0;k<list.size()-1;k++)
{
if (list.get(k).equals("+") || list.get(k).equals("-"))
{
x = Double.parseDouble(list.get(k - 1));
y = Double.parseDouble(list.get(k + 1));

if (list.get(k).equals("+"))
{
result+=(x+y);
}

if (list.get(k).equals("-"))
{
result+=(x-y);
}
}
}
}
display.setText(""+result);


}
}

In: Computer Science