Questions
I need to,  Modify my mapper to count the number of occurrences of each character (including punctuation...

I need to,  Modify my mapper to count the number of occurrences of each character (including punctuation marks) in the file.

Code below:

#!/usr/bin/env python

#the above just indicates to use python to intepret this file

#This mapper code will input a line of text and output <word, 1> #

import sys

sys.path.append('.')

for line in sys.stdin:

line = line.strip() #trim spaces from beginning and end

keys = line.split() #split line by space

for key in keys:

value = 1

print ("%s\t%d" % (key,value)) #for each word generate 'word TAB 1' line

In: Computer Science

Choose a successful company and discuss how they use information technology to achieve their competitive advantage...

Choose a successful company and discuss how they use information technology to achieve their competitive advantage in their market.

In: Computer Science

Create a swap method without a temporary variable. Implement an algorithm to figure out if someone...

  1. Create a swap method without a temporary variable.

  2. Implement an algorithm to figure out if someone has won a game of tic-tac-toe.

import java.util.Arrays;

public class ArrayReview {

    private int data[];

    public ArrayReview(int n) {
        data = new int[n];

        for (int i = 0; i < n; i++) {
            data[i] = (int) (Math.random() * 100);
        }
    }

    public int[] getData() {
        return data;
    }

    public void setData(int[] data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return Arrays.toString(data);
    }

    public void setKthItem(int k, int item) {
        if (k < 0 || k >= data.length) {
            return;
        }
        data[k] = item;
    }

    public int pickMaxIndex(int arr[], int start, int end) {
        int max = start;
        for (int i = start + 1; i <= end; i++) {
            if (arr[i] > arr[max]) {
                max = i;
            }
        }
        return max;
    }

    public void swap(int arr[], int i, int j) {
        if (arr[i] == arr[j]) {
            return;
        }
        arr[i] = arr[i] + arr[j];
        arr[j] = arr[i] - arr[j];
        arr[i] = arr[i] - arr[j];
    }

    public void selectionSort() {
        int i, j, max_index;
        int n = data.length;

        for (i = 0; i < n - 1; i++) {
            max_index = i;
            for (j = i + 1; j < n; j++)
                if (data[j] > data[max_index])
                    max_index = j;

            swap(data, max_index, i);
        }
    }

    public static void main(String[] args) {
        ArrayReview array = new ArrayReview(10);
        System.out.println(array);

        System.out.println("After sorting: ");
        array.selectionSort();
        for (int i : array.getData()) {
            System.out.printf("%-4d", i);
        }
        System.out.println();
    }

}

In: Computer Science

Hello, I am using IntelliJ IDEA with JavaFX to build a travel expensive calculator, but I...

Hello, I am using IntelliJ IDEA with JavaFX to build a travel expensive calculator, but I dont konw how to conver user input to doulbe. Pleasse teach me how to add all textfield and display it after I click submit.
public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception{

        Label label1 = new Label ("(1) Number of days on the trip");
        Label label2 = new Label ("(2) Transportation cost (choose one only)");
        Label label3 = new Label ("Airfare Cost ");
        Label label4 = new Label ("Miles driven  ");
        Label label5 = new Label ("(3) Conference registration cost ");
        Label label6 = new Label ("(4) Lodging Cost (per night) ");
        Label label7 = new Label ("(5) Food cost (total) ");
        Label label8 = new Label ("(6) Lodging Cost (per night) ");
        Label TotalExpensive = new Label("Total expenses: ");
        Label TotalExpensiveResult = new Label(" ");



        TextField field1 = new TextField();
        TextField field2 = new TextField();
        TextField field3 = new TextField();
        TextField field4 = new TextField();
        TextField field5 = new TextField();
        TextField field6 = new TextField();
        TextField field7 = new TextField();


        Button button1 = new Button ("Submit"); //Create submit button
        Button button2 = new Button ("Cancel"); //Create Cancel button

        HBox hBox = new HBox(20, label1, field1);
        HBox hBox1 = new HBox(10, label2);
        HBox hBox2 = new HBox(15, label3, field2);
        HBox hBox3 = new HBox(10, label4, field3);
        HBox hBox4 = new HBox(12, label5, field4);
        HBox hBox5 = new HBox(32, label6, field5);
        HBox hBox6 = new HBox(75, label7, field6);
        HBox hBox7 = new HBox(32, label8, field7);
        HBox hBox8 = new HBox(20, button1, button2);
        HBox hBox9 = new HBox(20, TotalExpensive, TotalExpensiveResult);


        hBox.setAlignment(Pos.BASELINE_RIGHT);
        hBox1.setAlignment(Pos.BASELINE_LEFT);
        hBox2.setAlignment(Pos.BASELINE_RIGHT);
        hBox3.setAlignment(Pos.BASELINE_RIGHT);
        hBox4.setAlignment(Pos.BASELINE_RIGHT);
        hBox5.setAlignment(Pos.BASELINE_RIGHT);
        hBox6.setAlignment(Pos.BASELINE_RIGHT);
        hBox7.setAlignment(Pos.BASELINE_RIGHT);
        hBox8.setAlignment(Pos.CENTER);
        hBox9.setAlignment(Pos.CENTER);

        hBox.setPadding(new Insets(0,0,15,0));
        hBox3.setPadding(new Insets(0,0,15,0));
        hBox8.setPadding(new Insets(25,0,15,0));



        GridPane gridPane = new GridPane ();

        gridPane.add(hBox, 0, 0);
        gridPane.add(hBox1, 0, 1);
        gridPane.add(hBox2, 0, 2);
        gridPane.add(hBox3, 0, 3);
        gridPane.add(hBox4, 0, 4);
        gridPane.add(hBox5, 0, 5);
        gridPane.add(hBox6, 0, 6);
        gridPane.add(hBox7, 0, 7);
        gridPane.add(hBox8, 0, 8);
        gridPane.add(hBox9, 0, 9);

        //*******Here*********
        button1.setOnAction(event -> {
            double cost = field1;
            TotalExpensiveResult.setText("Total Cost: $" + cost);
        });




        gridPane.setAlignment(Pos.CENTER);
        gridPane.setPadding( new Insets(20, 20, 20, 20));
        gridPane.setVgap( 10);
        gridPane.setHgap( 10);

        primaryStage.setTitle("Travel Expenses Calculator");
        primaryStage.setScene(new Scene (gridPane));
        primaryStage.show();


    }

In: Computer Science

This problem is about query flooding in P2P networks. Here, we explore the reverse-path routing of...

This problem is about query flooding in P2P networks. Here, we explore the reverse-path routing of the QueryHit messages in Gnutella. Suppose that Alice issues a Query message. Furthermore, suppose that Bob receives the Query message (which may have been forwarded by several intermediate peers) and has a file that matches the query.

5.1. As we know when a peer has a matching file, it sends a QueryHit message along the reverse path of the corresponding Query message. An alternative design would be for Bob to establish a direct TCP connection with Alice and send the QueryHit message over this connection. What are the advantages and disadvantages of such an alternative design?

5.2 In the Gnutella protocol, when the peer Alice generates a Query message, it inserts a unique ID in the message’s MessageID field. When the peer Bob has a match, it generates a QueryHit message using the same MessageID as the Query message. Describe how peers can use the MessageID field and local routing tables to accomplish reverse-path routing.

5.3. An alternative approach, which does not use message identifiers, is as follows. When a query message reaches a peer, before forwarding the message, the peer augments the query message with its IP address. Describe how peers can use this mechanism to accomplish reverse-path routing.

In: Computer Science

c programing language This assignment, which introduces the use of loops, solves the following problem: given...

c programing language

This assignment, which introduces the use of loops, solves the following problem: given a starting location in a city, how long does it take a “drunken sailor” who randomly chooses his direction at each intersection to reach the city’s border? You will read input values to set up the problem parameters, run several trials to determine an average number of steps for the sailor to reach the border, and output the results.

This problem is an example of a “random walk,” a succession of random steps that can model real world problems like stock price fluctuation or molecules traveling through liquid. The approach is a simple approximation of a Monte Carlo experiment, in which repeated random samples are run to find a numerical result.

This assignment has been split into three parts to help teach you how to build a large program in smaller pieces. Doing so makes the program easier to develop and test--you can make sure each smaller piece works and then integrate the pieces together. In this lab, Part 1, you will handle the input processing--prompting the user for inputs, reading those values, and testing for all possible input errors.

Remember, in addition to submitting your code, you MUST complete the Blackboard assignment "Program 4 style assessment" to get all of the points for this program. You can complete this "assignment" by typing a short message indicating you submitted your code through the textbook IDE.

In your Blackboard submission, please indicate which of the three parts of the program you have completed. If you plan to complete all three parts, do not submit to Blackboard until all parts are done.

2. Specification

Problem Description

The city is organized as a set of M x N blocks. The sailor’s position, which must always be an intersection or a point on the border, can be represented as a pair of coordinates (X, Y), where 0 ≤ X ≤ M, and 0 ≤ Y ≤ N. See Figure 1 in the figures document for an example of a 4 x 3 city with the sailor at position (3, 2).

Input Specification

Your input must be entered in the order listed below. All inputs are integers. Note that your program should prompt the user to enter each value and check that each input fits within the bounds described below, as well as ensure there are no formatting errors:

  • M and N, the number of blocks in the X (2 ≤ M ≤ 10) and Y planes (2 ≤ N ≤ 10), respectively. This pair of values will be entered on the same line.

  • A starting position for the sailor, input as a pair of integers (X,Y).

    • These values should be entered on the same line, separated by a space (e.g., 3 5).
      • You should NOT format your input as an (X,Y) pair using parentheses and a comma (e.g., (3,5)).
    • The sailor must always start within the city, so the starting coordinates are subject to the following bounds--notice that these bounds are based on the values of M and N, the first pair of inputs:
      • 1 ≤ X ≤ (M-1)
      • 1 ≤ Y ≤ (N-1)
  • T, The number of trials to execute (1 ≤ T ≤ 10). As we'll see in later parts of the assignment, each trial consists of placing the sailor at the starting point and randomly choosing movements until he reaches the border.

A sample set of input prompts and valid inputs to those prompts are shown below:

 

Output Specification

For this part of the program, after reading all inputs, your program should simply reprint the input values that were entered. So, given the sample inputs shown above, your program should print:

 

As noted above, detailed test cases showing appropriate input prompts can be found starting on page 3 of the figures document.

Error Checking

Your program should print a descriptive error message under any of the conditions below. For examples of valid error messages, see the built-in program test cases.

  1. Any of the inputs are incorrectly formatted and therefore cannot be read correctly using scanf()

    • Your error message should simply read Could not read input in all cases.

    • Don't forget to clear the line if there is a formatting error, as described in Lecture 11!

  2. The values of M and/or N (the number of X and Y blocks) do not fit in the ranges 2 ≤ M ≤ 10 and 2 ≤ N ≤ 10.

    • Your error message(s) should print # X blocks must be >= 2 and <= 10 or # Y blocks must be >= 2 and <= 10, depending on which input(s) caused the error.

    • It's possible for both values to be out of bounds, so your program may print two error messages for this pair of inputs.

  3. The values of X and/or Y (the sailor's starting position) do not fit in the ranges 1 ≤ X ≤ (M-1) and 1 ≤ Y ≤ (N-1).

    • Your error message(s) should print Starting X position must satisfy (1 <= X <= M-1) or Starting X position must satisfy (1 <= Y <= N-1), depending on which input(s) caused the error.

      • Each message should show the actual value of M-1 or N-1 (for example, 1 <= X <= 9)
  4. The number of trials does not fit in the range 1 ≤ T ≤ 10.

    • Your error message should print Number of trials must be > 0 and <= 10

3. Hints

Bounds checking and error messages

See Lecture 12 (M 9/30) for one example of how to handle input validation—repeatedly prompting your user to enter input values until the inputs are error-free.

Program development

Although the program has already been broken into smaller pieces, you can test your solution to this part piece by piece as well. I suggest starting with a single input validation loop--prompt for and read the number of X and Y blocks and test them for errors. If your program does all of those things successfully, it will pass the test case "Output test 2a". Then, move on to your input validation loop for the sailor's starting position, which, if it works correctly, will pass "Output test 2b." Adding a successful input validation loop for the number of trials will enable your program to pass the remaining test cases.

In: Computer Science

In math class, a student has written down a sequence of 16 numbers on the blackboard....

In math class, a student has written down a sequence of 16 numbers on the blackboard. Below each number, a second student writes down how many times that number occurs in the sequence. This results in a second sequence of 16 numbers. Below each number of the second sequence, a third student writes down how many times that number occurs in the second sequence. This results in a third sequence of numbers. In the same way, a fourth, fifth, sixth, and seventh student each construct a sequence from the previous one. Afterward, it turns out that the first six sequences are all different. The seventh sequence, however, turns out to be equal to the sixth sequence. Give one sequence that could have been the sequence written down by the first student. Explain which solution strategy or algorithm you have used.

In: Computer Science

create a code in JAVA that takes arguments to do a bfs(breadth first search) or a...

create a code in JAVA that takes arguments to do a bfs(breadth first search) or a dfs( depth first search) using a txt file as the graph input.

I have made most of the main function as well as a nose function I just need the bfs and dfs functions to work here's what I have so far, the comments that start with TODO are the parts that I need to finish

Main.java

import java.io.*;
import java.util;
ArrayList; import java.util.Iterator;
import java.util.List;

public class Main {
//class variables
private static boolean extendedOn;
public static String [] arr;
public static List<Node> nodeList;
public static Node firstNode;
public static int vertices;
//main method
public static void main(String[]args){
//the int for the arguments
int argument = 0;
int destination;
extendedOn = false;
boolean isDfs = false;
//checks to make sure that the user specified the destination
if(args[argument].equals("-dest")){
argument++;
try { destination = Integer.parseInt(args[argument]); argument++; }catch (Exception e{
System.out.println("Wrong Argument, needs an integer");
System.exit(0); } }
else{ System.out.println("Please specify the destination using -dest");
System.exit(0); }
//if the first arg is -e if(args[argument].equals("-e")){ argument++; extendedOn = true; }
//if args is dfs if(args[argument].equals("-dfs")){ argument++; isDfs = true; }
//if the args is -bfs else if(args[argument].equals("-bfs")){ argument++; isDfs = false; }
else{
System.out.println("Requires a Search Argument"); System.exit(0); }
//the argument that gets the file
File file = new File( args[argument] ); instantiateList(file); //gets the initial time Long timeStart = System.currentTimeMillis();
//figures out whether to do dfs or bfs
if(isDfs){ DFS(firstNode); }
else{ BFS(); }
//gets the endingTime Long timeEnd = System.currentTimeMillis(); System.out.println("\nTime Taken: " + (timeEnd - timeStart)); }

//method that populates the node list with how many vertices there are
private static void instantiateNodes(){
for(int y = 1; y <= vertices; y++){
nodeList.add(new Node(y)); }
firstNode = nodeList.get(0); }
//method to instantiate the List
public static void instantiateList(File file){
vertices = 0;
//String [] arr; //= new String[0];
//reads the file
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
//gets the vertices then creates the array which the buffered reader will put the values into
vertices = Integer.parseInt(br.readLine());
arr = new String[vertices];
int counter = 0;
//puts the values in String line = null;
while ((line = br.readLine()) != null)
{ arr[counter++] = line; } }
catch (FileNotFoundException e) { e.printStackTrace(); }
catch (IOException e) { e.printStackTrace(); }
//prints out the vertices and initializes the nodeList
System.out.println("\nVertices: " + vertices);
nodeList = new ArrayList<>(); instantiateNodes();
//for loop
for(int x = 0; x < vertices; x++){
//populates a list with the vertexes
String line = arr[x];
List adjacentVertexes = new ArrayList();
//while the line is not empty put it in the list
while(!line.isEmpty())
{ String vertex;
//if there are multiple vertexes
if(line.contains(" "))
{ vertex = line.substring(0, line.indexOf(" "));
//gets the node from the node list and adds it to the Node's adjacency List adjacentVertexes.add(nodeList.get( (Integer.parseInt(vertex)) - 1 )); }
//if there is only one vertex left else{ adjacentVertexes.add(nodeList.get( (Integer.parseInt(line)) - 1 ));
line = ""; break; } //changes the line to the next vertex line = line.substring(line.indexOf(" ")+1); }
//creates the node and initializes it
Node newNode = nodeList.get( ((Node)adjacentVertexes.get(0)).getVertex() - 1 );
//removes the name of the vertex and sets it's list adjacentVertexes.remove(0); newNode.setList(adjacentVertexes);
//adds the newNode to the list of Nodes nodeList.add(newNode); } }
//TODO method for the BFS
public static void BFS(){ System.out.println("BFS:"); }
//TODO method for the DFS
public static void DFS(){ System.out.println("DFS:"); } } }

Node.java

import java.util.List;
public class Node {    
//variable for if the node has been visited before     private boolean hasBeenSearched;   
 private List<Node> adjacency;    
private int vertex;    
public int searched;    
public Node(int v){      
 vertex = v;        
hasBeenSearched = false;     }    
//gets the vertex of the node    
public int getVertex(){        
return vertex;     }    
//sets the variables for if the node has already been searched    
public void setSearch(boolean search){         hasBeenSearched = search;     }    
//gets the varaible for the search of the node     public boolean getSearch(){     
   return hasBeenSearched;     }    
//method used to set the list full of nodes    
public void setList(List<Node> nodeList){         adjacency = nodeList;     }    
//method used to get the Node from the list     public Node getNode(int index){       
  return adjacency.get(index);     }    
//method used to get the size of the adjacency list     public int getSize(){         return adjacency.size();     } }

In: Computer Science

Please post code in format that can be copied. If possible please explain code but not...

Please post code in format that can be copied.

If possible please explain code but not necessary.

Directions:

1. Create a new project for the lab and copy stat.h, stat.cpp, and teststat.cpp into your workspace.

2. Now review the header file. Make sure you understand the design. Can you explain the difference between what the class represents versus how it plans to accomplish it?

3. Now edit the stat.cpp file. Notice that many of the member functions are missing. For all of the missing functions you will need to copy the function prototypes from the header file into the .cpp file. Remember to add Statistician:: before the name of each member function. (Not the friend functions or helper functions.)

4. Add the logic for 3 of the following methods (you may choose): • reset • mean • minimum • maximum • operator+ • operator==

5. You should now test all the functionality of the class (in the client/application code). Run the test code and determine if there are any errors in the code.

Stats.cpp

#include <iostream> // Provides istream classes
#include "stats.h"

using namespace std;

Statistician::Statistician( )
{
reset( );
}

void Statistician::next(double r)
{
total += r;
count++;
if ((count == 1) || (r < tinyest))
tinyest = r;
if ((count == 1) || (r > largest))
largest = r;
}


// implement reset

// implement mean

// implement minimum

// implement maximum

// implement operator +

// implement operator ==

istream& operator >>(istream& ins, Statistician& target)
{
double user_input;

while (ins && (ins.peek( ) != ';'))
{
   if (ins.peek( ) == ' ')
   ins.ignore( );
   else
   {
   ins >> user_input;
   target.next(user_input);
   }
}
ins.ignore( );

return ins;
}

ostream& operator <<(ostream& outs, Statistician& target)
{
outs << "Values for statistician object: " << endl;
outs << "\ttotal: " << target.total << endl;
outs << "\tcount: " << target.count << endl;
outs << "\tsmallest: " << target.tinyest << endl;
outs << "\tlargest: " << target.largest << endl << endl;

return outs;

}

stats.h

#ifndef STATS_H // Prevent duplicate definition
#define STATS_H
#include <iostream>

using namespace std;

class Statistician
{
public:
// CONSTRUCTOR
Statistician( );
// MODIFICATION MEMBER FUNCTIONS
void next(double r);
void reset( );
// CONSTANT MEMBER FUNCTIONS
int length( ) const { return count; }
double sum( ) const { return total; }
double mean( ) const;
double minimum( ) const;
double maximum( ) const;
// FRIEND FUNCTIONS
friend Statistician operator +
(const Statistician& s1, const Statistician& s2);
friend istream& operator >>
           (istream&, Statistician& s1);
       friend ostream& operator <<
       (ostream&, Statistician& s1);
private:
int count; // How many numbers in the sequence
double total; // The sum of all the numbers in the sequence
double tinyest; // The smallest number in the sequence
double largest; // The largest number in the sequence
};

// NON-MEMBER functions for the Statistician class
bool operator ==(const Statistician& s1, const Statistician& s2);

#endif

teststat.cpp


#include <iostream>
#include "stats.h"

using namespace std;

void menu (void)
{ cout<<endl<<endl;
cout<<"1. Add a number"<<endl;
cout<<"2. Reset the statistician"<<endl;
cout<<"3. Length"<<endl;
cout<<"4. Sum"<<endl;
cout<<"5. Mean"<<endl;
cout<<"6. Minimum"<<endl;
cout<<"7. Maximum"<<endl;
cout<<"8. Add"<<endl;
cout<<"9. Equality"<<endl;
cout<<"10. Print" << endl;
cout<<"11. Quit"<<endl<<endl;
cout<<"Enter selection>";
}

void add(Statistician& S)
{Statistician s2, s3;
s2.reset();
s3.reset();

//enter values for second stat
cout<<"Enter values for second stat, enter ; to stop"<<endl;
cin>>s2;

s3 = S + s2;
cout<<"Values for added statistician are:"<<endl;
cout<<"Length: "<<s3.length( )<<endl;
cout<<"Sum: "<<s3.sum( )<<endl;
}


void equal(const Statistician &S)
{ Statistician s2;
s2.reset();

//enter values for second stat
cout<<"Enter values for second stat, enter ; to stop"<<endl;
cin>>s2;

   if (s2==S) cout<<"equal"<<endl;
       else cout<<"unequal"<<endl;
}


//Beginning of main program
int main (void)
{
   int choice;
   double num;

   //declare a Statistician
   Statistician s;
   s.reset();

   do {
   //print menu
   menu();
   cin>>choice;

   switch (choice) {
       case 1 : cout<<endl<<"Enter a number> ";
               cin>>num;
               s.next(num);
               cout<<endl;
               break;

       case 2 : s.reset();
               cout<<endl<<"Statistician reset"<<endl;
               break;

       case 3: cout<<endl<<"Length is "<<s.length()<<endl;
               break;

       case 4: cout<<endl<<"Sum is "<<s.sum()<<endl;
               break;

       case 5: if (s.length() > 0)
                   cout<<endl<<"Mean is "<<s.mean()<<endl;
               else
                   cout<<"Must add a number first."<<endl;
               break;

       case 6: if (s.length() >0)
                   cout<<endl<<"Minimum is "<<s.minimum()<<endl;
               else
                   cout<<"Must add a number first."<<endl;
               break;

       case 7: if (s.length() >0)
                   cout<<endl<<"Maximum is "<<s.maximum()<<endl;
               else
                   cout<<"Must add a number first."<<endl;
               break;

       case 8: add(s);
               break;

       case 9: equal(s);
               break;

       case 10: cout << s;
               break;

       case 11: cout<<endl<<"Thanks and goodbye."<<endl;
               break;

       default : cout<<endl<<"Invalid command. Try again."<<endl;
   }

   } while (choice != 11);
}

In: Computer Science

Python. The array C has multibel peaks (+ , -). write a code that detect the...

Python.

The array C has multibel peaks (+ , -). write a code that detect the vlaues of all those peaks.
C = [0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0.0011
-0.0031
0.0011
0.0034
-0.0039
0.0004
0.0052
-0.0045
-0.0025
0.0067
-0.0038
-0.0034
0.0077
-0.0034
-0.0054
0.0076
-0.0011
-0.0063
0.0068
0.0004
-0.0084
0.0061
0.0037
-0.0086
0.0018
0.0063
-0.0045
-0.0069
0.0078
0.0027
-0.0132
0.0054
0.0133
-0.0131
-0.0060
0.0180
-0.0037
-0.0169
0.0140
0.0128
-0.0210
0.0048
0.0218
-0.0158
-0.0134
0.0216
-0.0004
-0.0205
0.0121
0.0126
-0.0197
-0.0031
0.0186
-0.0130
-0.0115
0.0160
-0.0010
-0.0114
0.0091
0.0026
-0.0087
0.0035
0.0043
-0.0047
0.0002
0.0025
-0.0015
-0.0006
0.0011
0.0002
-0.0006
-0.0004
0.0008
-0.0002
0
0
0
0
0
0
0
0
0
0
0]

In: Computer Science

What is my code missing? // chStr.cpp // Put your name here // Pseudocode #include #include...

What is my code missing?

// chStr.cpp

// Put your name here

// Pseudocode

#include

#include <___>

#include

using namespace std;

const string ANAME = "Katia Kool";

const char AGRADE = 'A';

const double COMMISSION_RATE_A = 0.02625;

const ___; . . . // likewise, constants for Betty

int main()

{

       int numberOfShares = 622;                // number of shares

       double pricePerShareA = 21.77;           // price per share

       double pricePerShareB = 12.44;           // price per share

       double stockA, stockB;                   // cost of stock, calculated

       double commissionA, commissionB;        // commission paid, calculated

       double totalA, totalB;                   // total cost, calculated

       // compute cost of the stock purchases

       stockA = pricePerShareA * numberOfShares;

       ___;

// compute amount of the commissions

       commissionA = stockA * COMMISSION_RATE_A;

       ___;

// compute total amounts

       totalA = stockA + commissionA;

       ___;

       // output results

       cout << fixed << showpoint << setprecision(2); // format output

       // your output should appear as below

       return 0;

}

/* Output:

Name: Katia Kool       Grade: A

Stock: $nnnnn.nn

Commission: $nnn.nn

Total: $nnnnn.nn

Name: Betty Boop       Grade: B

Stock: $nnnnn.nn

Commission: $nnn.nn

Total: $nnnnn.nn                  */

In: Computer Science

Write a C++ program that continuously requests a donation to be entered. If the donation is...

Write a C++ program that continuously requests a donation to be entered. If the donation is less than 0 or greater than 10, your program should print an appropriate message informing the user that an invalid donation has been entered, else the donation should be added to a total. When a donation of -1 is entered, the program should exit the repetition loop and compute and display the average of the valid donations entered.

In: Computer Science

in .java Write a program that reads an integer with 3 digits and prints each digit...

in .java

Write a program that reads an integer with 3 digits and prints each digit per line in reverse order. Hint: consider what you get from these operations: 319%10, 319/10, 31%10, ...

Enter an integer of exactly 3 digits(e.g. 538): 319
9
1
3
Hint: consider what you get from these operations:
319%10
319/10
31%10

In: Computer Science

The advent of Information and Communication Technology has had a huge impact whether one is doing...

The advent of Information and Communication Technology has had a huge impact whether one is doing research, communicating or buying a product online. Write an essay about how ICT has positively impacted the commerce, write an essay and provide references or sources.

In: Computer Science

Define Intellectual Property (IP) Regarding China and IP What additional evidence would convince you that China’s...

Define Intellectual Property (IP)





Regarding China and IP

What additional evidence would convince you that China’s theft of technological secrets represents a national strategy rather than just a series of isolated incidents?




What actions might Western countries take to protect the loss of technological secrets and to reduce the risk of continuing to do business in China?





What is the essential difference between competitive intelligence and industrial espionage, and how is competitive intelligence gathered?





What are the four criteria for fair use?

1

2

3

4

What types of things cannot be patented?  



You be the judge: How would you rule on the 3M vs. Formula 1 copyright?


In: Computer Science