Questions
The program runs but the math is not correct ( output for amount ) #include <iostream>...

The program runs but the math is not correct ( output for amount )

#include <iostream>

using namespace std;
int main()
{

int hoursParked;
double total;
double Car = 2.50 ;
double Truck = 5.50;
double Bus = 19.00;
double rateC = 1.50;
double rateT = 3.75;
double rateB = 6.75;
char type;


cout << "Please Enter number of hours parked and the type of car (Type: (C)ar or (T)ruck or (B)us): " << endl;
cin >> type >> hoursParked;


switch (type)
{
case 'C':
case 'c':
{
if (hoursParked <= 2.00)
total = 2 * 1.25;
else
total = (( hoursParked - 2.00 )* rateC)+ Car ;
}
case 'T':
case 't':
{
if (hoursParked <= 2.00)
total = Truck;
else
total = ((hoursParked - 2.00) * rateT) + Truck;
break;
}
case 'B':
case 'b':
{
  
if (hoursParked <= 2.00)
total = Bus;
else
total = ((hoursParked - 2.00)*rateB) + Bus;
break;
}
}
cout << "Vehicle type: ";
if(type == 'C')
cout << "Car" << endl;
else if(type == 'T')
cout << "Truck" << endl;
else
cout << "Bus" << endl;
cout << "Time:" << hoursParked << endl;
cout << "Amount Due:$" << total <<endl;

return 0;
}

In: Computer Science

. In this lab you will be making a text-based calendar program that looks like: JANUARY...

. In this lab you will be making a text-based calendar program that looks like:
JANUARY 2018
S M Tu W Th F S
1 2 3 4 5 6   
7 8 9 10 11 12 13
14 15 16 17 18 19 20   
21 22 23 24 25 26 27
28 29 30 31
Your calendar should be able to print months in the future and in the past.
Activity #1
In C++ create a calendar program that has the following two functions:
▪ printMonth – this function has two parameters (month, year) and will print out the calendar for the specified month in the format discussed in the introduction to this lab.
▪ printYear – this function has one parameter (year) and will print out the calendar for all 12 months in that year.
In addition to the above functions you should also create a main function that will test your program. In the main function the program should ask the user if he/she wants a year or month calendar. If the user wants a year calendar the program should input the year. If the user wants a month calendar the program should input the month and year.
In order to print the calendar for a given month you need to write an algorithm to determine which day of the week the first day of the month is on. You can determine this using the following information:
1. Number of days in each month.
a. January – 31 days
b. February – 28 or 29 days
c. March – 31 days
d. April – 30 days
e. May – 31 days
f. June – 30 days
g. July – 31 days
h. August – 31 days
i. September – 30 days
j. October – 31 days
k. November – 30 days
l. December – 31 days
2. Leap years.
In a leap year February has an extra day, which is why February can be either 28 or 29 days long. Years that are evenly divisible by 4 are leap years except when the year is also evenly divisible by 100. There is also an exception to this rule since years that are evenly divisible by 100 but also evenly divisible by 400 are considered leap years. For example:
• 2009 is not a leap year because it is not evenly divisible by 4.
• 2008 was a leap year because it was evenly divisible by 4 and not evenly divisible by 100.
• 1900 was not a leap year because even though it was evenly divisible by 4 it was also evenly divisible by 100 (and not evenly divisible by 400).
• 2000 was a leap year because it is evenly divisible by 4, evenly divisible by 100 and evenly divisible by 400.

In: Computer Science

Using the provided m1_mbox.txt, write a program that reads the data from the file, locates the...

Using the provided m1_mbox.txt, write a program that reads the data from the file, locates the lines containing sender information (those lines begin with 'From:'), and extracts just the email address of the sender of each message. It should then duplicate the set of email addresses for senders, and write the duplicated list to a file called senders.txt, so that each sender appears in the output file only once. In addition, your program should print to the screen the following stats: total number of email messages in the file, and number of unique senders. Your program should expect the input and output files to be in the same directory and you should hardcode this into your program (that is, do not use command line arguments).

In: Computer Science

State the data cube computation methods. Give example for each method

State the data cube computation methods. Give example for each method

In: Computer Science

java: create a conplete class named patient. the patient class shouls include teo private instance variables...

java: create a conplete class named patient. the patient class shouls include teo private instance variables named PatientID of type int lastName of type string. include all the parts of a well-formed class described. set the instance variable defaults to appropriate values.

In: Computer Science

In Python Which initial value of x will make the following piece of code leave a...

In Python

Which initial value of x will make the following piece of code leave a 9 in the final value of x?

x = ____?
if x < 7:
   x = x + 1
x = x + 2

a.

11

b.

9

c.

7

d.

None of the above

Which initial value of x will make the following piece of code leave a 20 in the final value of x?
x = ____?
if x * 2 <= 34:
   x = 0
else:
   x = x + 1

x = x + 1

a.

17

b.

18

c.

19

d.

20

e.

None of the above

What is a common word for the textual representation of a program?

a.

code

b.

prompt

c.

interpreter

d.

expression

e.

None of the above

Which statement reads a user-entered string into variable user_name?

a.

input = user_name()

b.

user_name = input()

c.

input() => user_name

d.

user_name = "input()"

e.

None of the above

What is the output?

count = 0
while count < 3:
     print('loop')
count = count + 1
print('final value of count:', count)

a.

Prints 'loop' once, then 'final value of count: 1'

b.

Prints 'loop' three times, then 'final value of count: 3'

c.

Prints 'loop' three times, then 'final value of count: 4'

d.

Prints 'loop' forever (infinite loop)

e.

None of the above

In: Computer Science

Please Why do we need a dynamic stack? How to implement a dynamic array stack?(JAVA)

Please

Why do we need a dynamic stack? How to implement a dynamic array stack?(JAVA)

In: Computer Science

In Python Dividing by zero is an example of which type of error? a. runtime b....

In Python

Dividing by zero is an example of which type of error?

a.

runtime

b.

syntax

c.

logic

d.

None of the previous

In the statement:age = input('Enter your age: '), the string 'Enter your age: ' is called a(n) _____.

a.

prompt

b.

prefix

c.

variable

d.

assignment

e.

None of the above

Fill in the blank so that the loop displays all odd numbers from 1 to 100.

i = 1
while i <= 100:
    print(i)
    i = _____

a.

1

b.

i + 1

c.

2

d.

i + 2

e.

None of the above

How many times does the following loop iterate?

i = 5
while i < 10:
    print(i)
    i = i + 1

a.

0

b.

4

c.

5

d.

6

e.

None of the above

In: Computer Science

Using the data structure concept of topological ordering,demonstrate using pseudocode how you can implement an operation...

Using the data structure concept of topological ordering,demonstrate using pseudocode how you can implement an operation to schedule picking during a delivery process in a warehouse.

In: Computer Science

Design a class named Person and its two subclasses named Student and Employee. Make Faculty and...

Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has a name, address, phone number, and e-mail address. A student has a class status (freshman, sophomore, junior, or senior). Define the status as a constant. An employee has an office, salary, and date hired. A faculty member has office hours and a rank. A staff member has a title. Override the toString method in each class to display the class name and the person’s name.

Write a test program that creates objects of Person, Student, Employee, Faculty, and Staff, and invoke their toString() methods.                  

In: Computer Science

Consider the following description of an enterprise. An auction Web site has items for sale that...

Consider the following description of an enterprise.

An auction Web site has items for sale that are provided by sellers. Each item has an opening price, a description, and ending time. Customers submit bids. The highest earliest bid submitted before the ending time is the winning bid and the item is sold to the bidder. Each seller must pay 5% of the winning bid. The auction company wants to be able to analyze the sales behavior of its customers and sellers and so must keep track of all bids and sales.

  1. What entity classes are mentioned in the description?
  2. List seven attributes that will be used in a data model for the auction company.
  3. What relationship types exist between the entity classes of part a?
  4. Give three example entities of each class listed in part a.

In: Computer Science

Is there any idea that what is the R formula for next ten days of weather...

Is there any idea that what is the R formula for next ten days of weather if you can advice

In: Computer Science

(To be written in Java code) A personal phone directory contains room for first names and...

(To be written in Java code)

A personal phone directory contains room for first names and phone numbers for 30 people. Assign names and phone numbers for the first 10 people. Prompt the user for a name, and if the name is found in the list, display the corresponding phone number. If the name is not found in the list, prompt the user for a phone number, and add the new name and phone number to the list.

Continue to prompt the user for names until the user enters quit. After the arrays are full (containing 30 names), do not allow the user to add new entries.

Use the following names and phone numbers:

Name Phone #
Gina (847) 341-0912
Marcia (847) 341-2392
Rita (847) 354-0654
Jennifer (414) 234-0912
Fred (414) 435-6567
Neil (608) 123-0904
Judy (608) 435-0434
Arlene (608) 123-0312
LaWanda (920) 787-9813
Deepak (930) 412-0991

This code was provided to start with:

import java.util.*;
class PhoneNumbers
{

public static void main (String[] args)

{

// write code here

}

}

In: Computer Science

The bits transmitted by four stations A, B, C and D are multiplexed using Code Division...

The bits transmitted by four stations A, B, C and D are multiplexed using Code Division Multiplexing (CDMA). Assume A transmits a 1 bit, B transmits a 0 bit, C transmits a 1 bit, and D is silent. Assume the following are the chip sequences of the four stations, answer below questions: SA = (-1 -1 -1 +1 +1 -1 +1 +1); SC = (-1 -1 +1 -1 +1 +1 +1 -1) SB = (-1 +1 -1 +1 +1 +1 -1 -1); SD = (-1 +1 -1 -1 -1 -1 +1 -1)

i) What is the transmitted sequence?

ii) Show how the receiver determines station B’s transmission.

In: Computer Science

In.java In this program write a method called upDown that takes three integers as arguments and...

In.java

In this program write a method called upDown that takes three integers as arguments and returns one of these 3 strings:

  • "increasing" if they are in strictly increasing order (note that 3,3,4 - are not strictly increasing),
  • "decreasing" if they are in strictly decreasing order.
  • "none" otherwise.
    I recommend you use a complex condition to check for this (that is, have a single if statement with one big question).

In the main method do the following:

  • read three integers from the user and call upDown for those integers, save the result in a variable, res1, and then print it.
  • read again three integers from the user and call upDown for those integers, save the result in another variable, res2, and then print it.
  • compare res1 and res2 and print "same" or "different"

read three integers from the user and call upDown for those integers, save the result in a variable, res1, and then print it.

---------- Sample run 1:
Enter three integers separated by spaces: 2 0 9
These numbers are in order: none
Enter three integers separated by spaces: 17 90 567
These numbers are in order: increasing
different

---------- Sample run 2:
Enter three integers separated by spaces: 90 9 1
These numbers are in order: decreasing
Enter three integers separated by spaces: 7 3 1
These numbers are in order: decreasing
same

---------- Sample run 3:
Enter three integers separated by spaces: 3 3 4
These numbers are in order: none
Enter three integers separated by spaces: 8 1 16
These numbers are in order: none
same

In: Computer Science