Questions
C++ Sort Vector of Strings (case-sensitive) Without using libraries, how would I arrange a vector like...

C++ Sort Vector of Strings (case-sensitive)

Without using libraries, how would I arrange a vector like this alphabetically?

vector words {"September", "test" "seven", "apple"}

The output should be: "apple, seven, September, test"

In: Computer Science

Use a recursive tree method to compute a tight asymptotic upper bound for recurrence function T(n)=...

Use a recursive tree method to compute a tight asymptotic upper bound for recurrence function T(n)= 2T(n/5)+3n . then use substitution method to verify your answer.

In: Computer Science

Write the code that will produce the given "after" result from the given "before" starting point...

Write the code that will produce the given "after" result from the given "before" starting point by modifying links between the nodes shown. Assume that the nodes have already been declared and initialized to match the "before" figure below. There may be more than one way to write the code, but do NOT change any existing node's data field value. Do not create any new nodes, you must just rearrange the existing nodes.  

If a variable does not appear in the "after" picture, it doesn't matter what value it has after the changes are made. If a given node object does not appear in the "After" picture, you must free its memory to avoid a memory leak.

You should not be depending on the values of the nodes, the second test case here will test a list1->a->b->c->d (some other list of the values). And it must be re-arranged in the same way.  

Before
list1: 1 -> 2 -> 3 -> 4 /
After
list1: 3 -> 2 /
list2: 4 -> 1 /

Assume that you are using the following ListNode structure:

struct ListNode {
    int data;        // data stored in this node
    ListNode* next;  // a link to the next node in the list
​};

Edit here:

#pragma once
#include <iostream>
using namespace std;

struct ListNode {
int data;
ListNode* next;
};

void pointerFun(ListNode* &list1, ListNode* &list2) {
// TODO: write your code here
}

In: Computer Science

Write a program that calculates and prints the bill for a cellular telephone company. The company...

Write a program that calculates and prints the bill for a cellular telephone company. The company offers two types of services: regular and premium. Its rates vary depending on the type of service. The rates are computed as follows:

Regular service: $10.00 plus the first 50 minutes are free. Charges for over 50 minutes are $0.20 per minute.

Premium Service:        $25.00 plus

  1. For calls made from 6:00 A.M. to 6:00 P.M., the first 75 minutes are free; charges for over 75 minutes are $0.10 per minute.
  2. For calls made from 6:00 P.M. to 6:00 A.M., the first 100 minutes are free; charges for over 100 minutes are $0.05 per minute.

Your program should output the type of service, number of minutes the telephone service was used, and the amount due from the user.

For the premium service, the customer may be using the service during the day and night. Therefore, to calculate the bill, you must ask the user to input the number of minutes the service was used during the day and the number of minutes the service used during the night.

IN PYTHON PLEASE

In: Computer Science

If you are starting a now Online Ecommerce Business, do you think it’s important to run...

If you are starting a now Online Ecommerce Business, do you think it’s important to run media on TV, Billboard and other offline media channels? Or would you only run media via Online channels?

In: Computer Science

provide step by step explanation of Man in the Middle attack. Please be very specific (What...

provide step by step explanation of Man in the Middle attack. Please be very specific (What is shared, what is sent etc).

In: Computer Science

Convert the following decimal numbers into their 32-bit floating point representation (IEEE single precision). You may...

Convert the following decimal numbers into their 32-bit floating point representation (IEEE single precision). You may use a calculator to do the required multiplications, but you must show your work, not just the solution.

1. -59.75 (ANSW: 11000010011011110000000000000000)

2. 0.3 (ANSW: 00111110100110011001100110011010 (rounded)
00111110100110011001100110011001 (truncated; either answer is fine))

Please show all work

In: Computer Science

Write a program that simulates flipping a coin repeatedly until three consecutive        heads are...

Write a program that simulates flipping a coin repeatedly until three consecutive
       heads are tossed. The program should then display the total number of times the coin was
       flipped. The user does not have to enter any information and we must use a while loop.

In: Computer Science

What is the list of commands required to upgrade a cisco IOS, ensuring that the system...

What is the list of commands required to upgrade a cisco IOS, ensuring that the system will use the IOS file when booting?

In: Computer Science

This question is related to making an object method call by reference instead of by value....

  1. This question is related to making an object method call by reference instead of by value. Use the (CallValueTest.java). Convert the calculation method (calc(..) ) in the Test class. You need to modify the Test class attributes and constructor to support this new cal (…) method. Your program should display:

Before call obj.a 15 obj.b is 20

Before call obj.a 30 obj.b is 10

CallValueTest.java

package com.Assignment3.Q1;

class Test {
  
   void calc(int a, int b) {
       a *= 2;
       b /= 2;
       System.out.println(" in calc a = " + a + " b = " + b);
   }
  
}
public class CallByValueTest {
   public static void main (String args[]) {
       Test ob = new Test();
       int a =15, b = 20;
       System.out.println ("Before calc :a = " + a + " b " + b);
      
       ob.calc (a, b );
      
       System.out.println(" After calc: a = " + a + " b " + b);
      
   }
}

In: Computer Science

Write a C program that calculates the percent saves for a hockey goalie for 4 games...

Write a C program that calculates the percent saves for a hockey goalie for 4 games and
the overall percentage of saves which is saves divided by the sum of goals plus saves.
input->process->output->repeat
The program should prompt the user to enter the number of goals and the number of
saves for each of the 4 games. The program should then calculate and display the percent
saves obtained for each game. Once processing is complete for the games, the program
will calculate the overall percent saves (total saves / sum of total saves and total goals
and display the results. Then print a friendly exit message as shown below.
Once you create, compile, link and run your program, your program should present the
following input/output dialog to the user:

Welcome to the Goalie Saves Analysis
This program will calculate the percentage of saves for
a hockey goalie for 4 games after you have entered the
games and saves for the goalie.

Enter the number of goals for game #1: 3
Enter the number of saves for game #1: 22
The percent saves for game #1 is 88.0%

Enter the number of goals for game #2: 4
Enter the number of saves for game #2: 33
The percent saves for game #2 is 89.2%

Enter the number of goals for game #3: 1
Enter the number of saves for game #3: 16
The percent saves for game #3 is 94.1%

Enter the number of goals for game #4: 0
Enter the number of saves for game #4: 22

The percent saves for game #4 is 100.0%
The percent saves for 4 games for this goalie is 92.1%

Thanks for using the Bruins Goalie Saves Analysis program.

In: Computer Science

Explain about the role of "bus" in Von Neumann architecture. Why a slow bus-speed can cause...

Explain about the role of "bus" in Von Neumann architecture. Why a slow bus-speed can cause a performance-bottleneck in Von Neumann architecture?

In: Computer Science

Advanced Inheritance Concepts (Exercise 7) The Cullerton Park District holds a mini-Olympics each summer. Create a...

Advanced Inheritance Concepts (Exercise 7)

The Cullerton Park District holds a mini-Olympics each summer. Create a class named Participant with fields for a name, age, and street address. Include a constructor that assigns parameter values to each field and a toString() method that returns a String containing all the values. Also include an equals() method that determines two participants are equal if they have the same values in all three fields.

Create an application with two arrays of at least eight participants each—one holds participants in the mini-marathon, and the other holds participants in the diving competition. Prompt the user for participant values. After the data values are entered, display values for participants who are in both events.

Participant.java

public class Participant
{
// private variables here

public Participant(String n, int a, String add)
{
// constructor code here
}
public String getName()
{
// method code here
}
public int getAge()
{
// method code here
}
public String getAddress()
{
// method code here
}
public String toString()
{
// method code here
}
public boolean equals(Participant p)
{
// method code here
}
}

TwoEventParticipant.java

import java.util.*;
public class TwoEventParticipants
{
public static void main(String[] args)
{
Participant marathoners[] = new Participant[8];
Participant divers[] = new Participant[8];
int i, j;
String name;
int age;
String address;
Scanner input = new Scanner(System.in);
System.out.println("Enter mini-marathon participants");
for(i = 0; i < marathoners.length; ++i)
{
System.out.print("Enter name: ");
name = input.nextLine();
System.out.print("Enter age: ");
age = input.nextInt();
input.nextLine();
System.out.print("Enter address: ");
address = input.nextLine();
marathoners[i] = new Participant(name, age, address);
}
System.out.println("\nEnter diving participants");
for(i = 0; i < divers.length; ++i)
{
System.out.print("Enter name: ");
name = input.nextLine();
System.out.print("Enter age: ");
age = input.nextInt();
input.nextLine();
System.out.print("Enter address: ");
address = input.nextLine();
divers[i] = new Participant(name, age, address);
}   
System.out.println("\nParticipants who are in both events:");
for(i = 0; i < marathoners.length; ++i)
for(j = 0; j < divers.length; ++j)
if(marathoners[i].equals(divers[j]))
System.out.println(marathoners[i].toString());
}
}

Possible Answer:

Participants who are in both events:

Participant_2

10

Apartment No. 2

Participant_6

13

Apartment No. 6

Participant_7

13

Apartment No. 7

In: Computer Science

Complete the following assignment in C programming language. Get the user’s first name and store it...

Complete the following assignment in C programming language.

  1. Get the user’s first name and store it to a char array
    • Declare a character array to hold at least 20 characters.
    • Ask for the user’s first name and store the name into your char array.
    • Hint: Use %s for scanf. %s will only scan one word and cannot scan a name with spaces.
  2. Get 3 exam scores from the user:
    • Declare an array of 3 integers
    • Assume the scores are out of 100, and use a for loop to get user’s input
    • Your prompts should print out which exam score you are asking for:
      1. Example: “What is the score of Exam #1?” … “What is the score of Exam #3?”
    • Warning: Be careful of your array indexes!
  3. Find out the average exam score:
    • Use a for loop to calculate the sum of all exams.
    • Divide the sum by 3 to get the average and store the is data in a variable.
  4. Print out the summary for the use similar to:
    • “Hello NAME, based on your exam score of 80, 90, and 100, your average is 90.0 with a letter of an ‘A.’”

In: Computer Science

Reserved words are keywords which will not be used for identifier. For example, Java reserved words...

Reserved words are keywords which will not be used for identifier. For example, Java reserved words include for, while, if and etc. What are the disadvantages of having “too many reserved words”?

In: Computer Science