Questions
Decode the following secret ASCII message (reading across): 100 1000 110 0001 111 0110 110 0101...

Decode the following secret ASCII message (reading across):

100 1000 110 0001 111 0110 110 0101

010 0000 110 0001 010 0000 110 1110

110 1001 110 0011 110 0101 010 0000

110 0100 110 0001 111 1001 010 0001

Decode the following secret ASCII message (reading across):

100 1101 110 0101 110 0101 111 0100

010 0000 110 0001 111 0100 010 0000

110 1101 110 1001 110 0100 110 1110

110 1001 110 0111 110 1000 111 0100

010 1110

In: Computer Science

Project 1 - OO Programming Create a program that simulates cars racing and allows users to...

Project 1 - OO Programming

Create a program that simulates cars racing and allows users to bet on the races ( start users with $100 )

In main, prompt the user to enter details needed to create 2 instances of the Car class you create.

Ask the user to bet on which car will win the race ( use the overridden << method to display car details ), ensure the bet is between 1 and the amount of money the user has currently.

Create a Car class that has attributes for name, make, model, quarter mile time, and max speed.

( You can reference https://www.0-60specs.com/0-60-times/ - or just make values up )

Add a method Race that accepts a reference to another instance of car for the car to race.

When racing, add a random -1.0 - 1.0 second adjustment to the quarter mile time to account for wind and other conditions.

return a string result that says which car wins the race and by how much time.

Display the results of the bet and the users new balance.

Allow the user to keep creating cars to race until they are done or out of money.

In: Computer Science

Drivers are concerned with the mileage obtained by their automobiles. One driver has kept track of...

Drivers are concerned with the mileage

obtained by their automobiles. One driver has kept track of

several trips by recording miles driven and gallons used for

each trip. Develop a java program that uses a while statement

to input the miles driven and gallons used for each trip. The

program should calculate and display the miles per gallon

obtained for each trip and print the combined miles per gallon

obtained for all tankfuls up to this point.

Enter miles driven (-1 to quit): 287

Enter gallons used: 13

MPG this trip: 22.076923

Total MPG: 22.076923

Enter miles driven (-1 to quit): 200

Enter gallons used: 10

MPG this trip: 20.000000

Total MPG: 21.173913

Enter the miles driven (-1 to quit): 120

Enter gallons used: 5

MPG this trip: 24.000000

Total MPG: 21.678571

Enter the miles used (-1 to quit): -1

In: Computer Science

Overview For this program, add code to program 2 that will (potentially) allow for a discount...

Overview

For this program, add code to program 2 that will (potentially) allow for a discount to be applied to the cost of the tickets to the movie theater.

Basic Program Logic

The program should start the same as program 2 by asking the user for the number of tickets to purchase for adult and children.

The program should then ask the user if they have a discount coupon. This is a string value. A value of "Y" indicates the user does have a coupon. Any other value indicates the user does not have a coupon.

If the user does have a discount coupon, ask if the coupon is for a free adult ticket or free child ticket. This is also a string value. A value of "A" is for a free adult ticket which means that a discount of 11.25 should be applied to total purchase. A value of "C" is for a free child ticket which means that a discount of 4.50 should be applied to the total purchase. Any other value is invalid which means that no discount should be applied to the total purchase. If an invalid discount type is selected, display a message to the user that their discount type is not valid and that no discount will be applied.

Calculate the user's total purchase amount, making sure to apply the appropriate discount amount (11.25, 4.50, or 0.00).

Finally, display the results similar to program 2: the number of adult tickets that were purchased, the number of child tickets that were purchased, the discount amount (if a discount was applied to the purchase), and the total purchase amount. The discount amount should ONLY be displayed if the user indicated they had a discount coupon. As with program 2, use setw to line up the last digit of the displayed values and setprecision to display 2 digits after the decimal point.

Program Requirements

  1. At the top of the C++ source code, include a documentation box that resembles the one from programs 1 and 2.

  2. The dollar amounts should all be displayed with exactly 2 digits after the decimal point, including zeros.

  3. The numeric values read in from the user should all be integer values. The discount values read in from the user should all be string values. Use meaningful variable names.

  4. Make sure and test the program with values other than those in the sample output.

Output

A few runs of the program should produce the following results:

Run 1

Enter the number of adult tickets that are being purchased: 2
Enter the number of child tickets that are being purchased: 5

Do you have a discount coupon (Y for yes)? Y

Is the discount for an adult or child's ticket (A for adult, C for child)? C


************************************
           Theater Sale
************************************
Number of adult tickets:           2
Number of child tickets:           5

Discount:                       4.50

Total purchase:                40.50

Run 2

Enter the number of adult tickets that are being purchased: 1
Enter the number of child tickets that are being purchased: 2

Do you have a discount coupon (Y for yes)? n


************************************
           Theater Sale
************************************
Number of adult tickets:           1
Number of child tickets:           2

Total purchase:                20.25

Run 3

Enter the number of adult tickets that are being purchased: 2
Enter the number of child tickets that are being purchased: 2

Do you have a discount coupon (Y for yes)? Y

Is the discount for an adult or child's ticket (A for adult, C for child)? S
Error: S is not a valid discount type. No discount will be applied

************************************
           Theater Sale
************************************
Number of adult tickets:           2
Number of child tickets:           2

Discount:                       0.00

Total purchase:                31.50

Run 4

Enter the number of adult tickets that are being purchased: 4
Enter the number of child tickets that are being purchased: 2

Do you have a discount coupon (Y for yes)? Y

Is the discount for an adult or child's ticket (A for adult, C for child)? A


************************************
           Theater Sale
************************************
Number of adult tickets:           4
Number of child tickets:           2

Discount:                      11.25

Total purchase:                42.75

In: Computer Science

Q.N. 1:- An AM index between 0 and 1 indicates what? a. the AM signal is...

Q.N. 1:-

An AM index between 0 and 1 indicates what?

a. the AM signal is very small and will not be detected by the receiver

b. distortion of the signal will prevent detection and demodulation

c. the received modulated signal will have minimal distortion

d. the AM index is not important

Q.N. 2:-

Given the following AM modulated signal, determine the original message, m(t):

s(t) = 2.5[1+0.5 cos(2π25kHzt)] cos(2π88MHzt)

a. m(t) = 1.25cos(2π25kHz*t)

b. m(t) = 1.25cos(2π88MHz*t)

c. m(t) = 2.5cos(2π25kHz*t)

d. m(t) = 2.5cos(2π88MHz*t)

Q.N. 3:-

Given the following AM modulated signal, determine the occupied frequency bandwidth(note: assume double-sideband large carrier (DSB-LC):

s(t) = 2.4[1+0.7 cos(2π33Hz*t)] cos(2π10GHz*t)

a. Frequency bandwidth = 33 Hz

b. Frequency bandwidth = 66 Hz

c. Frequency bandwidth = 10GHz

d. Frequency bandwidth = 20GHz

Q.N. 4:-

Given the following message and carrier equations, determine the AM modulated signal equation: m(t)=4cos(2π4kHz*t), c(t)=4cos(2π3GHz*t)

a. s(t)=2[1 + 0.67cos(2π4000t)]cos(2π3GHz*t)

b. s(t)=2[1 + 0.67cos(2π3E9t)]cos(2π4kHz*t)

c. s(t)=4[1 + 1cos(2π4000t)]cos(2π3E9t)

d. s(t)=4[1 + 1.5cos(2π3GHz*t)]cos(2π4000t)

In: Computer Science

Design and implement a class called circle_location to keep track of the position of a single...

Design and implement a class called circle_location to keep track of the position of a single point that travels around a circle. An object of this class records the position of the point as an angle, measured in a clockwise direction from the top of the circle. Include these public member functions:
• A default constructor to place the point at the top of the circle.
• Another constructor to place the point at a specified position.
• A function to move the point a specified number of degrees around the circle. Use a positive argument to move clockwise, and a negative argument to move counterclockwise.
• A function to return the current position of the point, in degrees, measured clockwise from the top of the circle. Your solution should include a separate header file, implementation file,
and an example of a main program using the new class.

In: Computer Science

Write a program in C that takes as input a four-digit hexadecimal number and prints the...

Write a program in C that takes as input a four-digit hexadecimal number and prints the next

10 hexadecimal numbers. Define a hexadecimal number as

int hexNum[4]

Allow upper- or lowercase letters for input and use uppercase letters for the hexadecimal

output. For example, 3C6f should be valid input and should produce output 3C6F, 3C70,

3C71, . . . .

In: Computer Science

Write a program in C that takes as input an 8-bit binary number and prints the...

Write a program in C that takes as input an 8-bit binary number and prints the next 10 binary

numbers. Define a binary number as

int binNum[8];

Use binNum[0] to store the most significant (i.e., leftmost) bit and binNum[7] to store the least

significant bit. Ask the user to input the first binary number with each bit separated by at

least one space.

In: Computer Science

(java)Fix the code in this program. Fix lines, add lines… Comment each line that you fixed...

(java)Fix the code in this program. Fix lines, add lines…

Comment each line that you fixed … what you did to fix it.

import java.util.Scanner;
public static void main(String[] args)
{
// This program Converts grade Points into a Letter grade.
int gradePoints == 00; // Declare variable and assign initial value
System.out.printl("Enter Grade Points: ";
//Input gradePoints;
if ( gradePoints >= -42 )
{ System.out.println("Grade = A"); }
// if true, then ends here, if false drop to next line
else if ( gradePoints =< 80 ) { System.out.println("Grade = B"); }
//if true, then ends here, if false drop to next line
else if ( gradePoints >= 70 ) { System.out.println("Grade = C"); }
//if true, then ends here, if false drop to next line
else if ( gradePoints >= 60 ) { System.out.println("Grade = D"); }
// if true, then ends here, if false drop to next line
else { System.out.println("Grade = A"; } // done.
}

In: Computer Science

PLEASE PROVIDE COMMENTS ON STEPS IMPORTANT NOTE: The library string functions cant be used. You must...

PLEASE PROVIDE COMMENTS ON STEPS

IMPORTANT NOTE:

The library string functions cant be used. You must use pointers and the switch statement to execute this program. Assume that the vowels are a, e, i, o, u. The modification has to be done in the original char array without creating a new array.

Write a C++ program that modifies a string (null terminated) as follows:

Consonants are positioned at the beginning of the string and vowels are moved to the end of the string.

Example :

Original string : washer

New string : wshrae

In: Computer Science

Write a program that asks the user to enter a bunch of words until they type...

Write a program that asks the user to enter a bunch of words until they type the word “quit”. Count how many words had 5 letters or more.

Sample program

Enter a word: nothing

Enter a word: stop

Enter a word: word

Enter a word: program

Enter a word: supercalifragilisticexpialidocious

Enter a word: quit

You entered 3 words that were longer than 5 letters.

In: Computer Science

(java))Write a “Temperature Conversion” program. Declare choice, tempIn, tempOut variables Prompt the user with the messages...

(java))Write a “Temperature Conversion” program.

Declare choice, tempIn, tempOut variables

Prompt the user with the messages to choose: 1) Centigrade to Fahrenheit, 2) Fahrenheit to centigrade.

Prompt the user for temperature value (tempIn) to convert.

Calculate new tempOut. The calculation of the new tempOUT depends on choice 1 or 2 above.\

( Lookup up the C to F formula online, loop up the F to C formula online )

Print out the the F and the C temps.

Be sure to use the C and F temperature notation ASCII symbol.

In: Computer Science

how can i convert this to work in visual basic ? what are the formulas for...

how can i convert this to work in visual basic ? what are the formulas for that?

You must create a Windows Forms application as the Conversion project including a picture of money on your form.  Create a textbox for the user to entry a dollar amount. Determine the number of quarters, dimes, nickels, and pennies using label controls to display the results.  In your calculation, you should use constant variables.


ex)

Enter dollar amount for conversion of 4.69

Number of quarters = 18
Number of dimes = 1
Number of nickels = 1
Number of pennies = 4

In: Computer Science

Print out a table of powers. Use a for loop that goes from 101 to 112...

Print out a table of powers. Use a for loop that goes from 101 to 112 inclusive. Print out r, r squared, r cubed, square root of r, and cube root of r. Use two decimal places for the roots, and zero decimal places for the squares and cubes, and 2 decimal places for the averages. Use commas in numbers 1000 and above. After the loop, print out the average of the r squared and r cubed. Use columns for your data. Print column headings above your loop.Also print the data to a file.

In C++

In: Computer Science

#include <iostream> #include <string> #include <array> #include <vector> using namespace std; void f(int x, int &y);...

#include <iostream>
#include <string>
#include <array>
#include <vector>
using namespace std;
void f(int x, int &y);
int main(){
  char s1[] = "zoey";
  char s2[] = "zoey";
  string s3 = s1;
  string s4 = s2;
  cout << "1.  sizeof(s1) = " << sizeof(s1) << endl;
  if(s1 == s2) cout << "2.  s1 == s2 is true" << endl;
  else cout << "2.  s1 == s2 is false" << endl;
  if(s3 == s4) cout << "3.  s3 == s4 is true" << endl;
  else cout << "3.  s3 == s4 is false" << endl;
  array<double, 5> d = {7.5, 2.8, 9.5, 88.7, 1.7};
  vector<int> v;
  for(size_t i = 0; i < 4; i++){
    v.push_back((unsigned long) &d[i+1] - (unsigned long) &d[i]);
  }
  cout << "4.  The values stored in v are ";
  for(int value : v){
    cout << value << " ";
  }

cout << endl;

char * p1 = &s4[0];
*p1 = 'j';
*(&s4[3]) = 's';
cout<<"5. s4="<<s4<<endl;

s4 = s1;
string s5("zoey\0 is awesome"); cout<<"6. s5="<<s5<<endl;

int q[5];
int * p2 = q;
for(int i = 1; i < 6; i++) *(p2 + i - 1) = i * 5;
f(*(q + 1), *(q + 2));
cout << "7. What is the value of (q[1] + q[2])?" << endl;
cout << "8. What is the value of q?" << endl;
cout << "9. p2 = " << (unsigned long) p2 << ", q = " << (unsigned long) q << endl; cout<<"10.p2="<<p2<<",q="<<q <<endl;

2

return 0; }

void f(int x, int &y){
  x = -1;

y = -2; }

An output for the C++ (version 14) program above executed on nike.

1. sizeof(s1) = 5
2. s1 == s2 is false
3. s3 == s4 is true
4. Thevaluesstoredinvare8888
5. s4 = joes
6. s5 = zoey
7. What is the value of (q[1] + q[2])?
8. What is the value of q?
9. p2 = 140726181901504, q = 140726181901504 10. p2 = 0x7ffd5e1534c0, q = 0x7ffd5e1534c0

Create a file called lab04Answers.txt on nike, and answer the following 10 questions based on the C++ program and its output above.

  1. In the output for 1 above, why is sizeof(s1) = 5 even though s1 contains only four letters? What is character is being stored in the fifth byte of s1?

  2. In the output for 2 above, why does s1 == s2 result in false when both s1 and s2 contain the same character sequence? What values are being compared in s1 == s2 to yield a result of false?

  3. In the output for 3 above, why does s3 == s4 result in true? What values are being compared in s3 == s4? What types of strings are s3 and s4, and how are they different than the types of string used for s1 and s2?

  4. In the output for 4 above, explain why the values stored in v are all 8? Explain your answers in terms of how the memory addresses are being stored for d. Assume the starting address of d is 500, then what are the memory addresses for d[0], d[1], d[2], d[3], and d[4]?

  5. Why is joes in the output for 5 above? Explain how the first character in s4 was changed to ’j’. Explain how the last character in s4 was changed to ’s’.

  6. Why did the output for 6 above print s5 = zoey instead of s5 = zoey is awesome?

  7. As asked in the output for 7 above, what is the value of (q[1] + q[2])? Is it correct syntax to use *(q[1] + q[2]) to compute the value of (q[1] + q[1])? Explain why this syntax is correct or why it isn’t correct.

  8. As asked in the output for 8 above, what is the value of q? Explain what this value represents in terms of what is going on in the program’s memory at runtime.

  9. Consider the output for 9 and 10 above. Why do these memory addresses typically change each time this program is run on nike?

  10. Consider the output for 9 and 10 above. The memory addresses that are being display to standard output for 9 above are using which number system: binary, octal, base-10, or hexadecimal? The memory addresses that are being display to standard output for 10 above are using which number system: binary, octal, base-10, or hexadecimal?

In: Computer Science