Questions
Please read the whole program (all the way to the bottom), Thanks in advance! Develop car...

Please read the whole program (all the way to the bottom), Thanks in advance!

Develop car rental application may use to produce a receipt. A receipt will be formatted as follows:

          E Z – R I D E R
      Rental Receipt

Customer       : John Jones                          
Driver License : PA 12343
Telephone      : 724-555-8345
Credit Card    : VISA 12345678012

Vehicle        : Mercedes 350E
Tag #          : PA 342399
Rent Class     : Luxury Sedan
Daily Rate     : $   95.00
Weekly Rate    : $ 545.00

Date/Time Out : 01/10/2017 at 10:45
Date/Time In   : 01/20/2017 at 11:44
Rental Charge : $ 830.00
Airport Tax    : $ 150.00
Sales Tax      : $   49.80
Total          : $ 1029.80


For this application create four main classes for customer, rental class, vehicle, and rental agreement. The customer class should have six pieces of information (i.e. instance variables) including customer name (as a String), driver’s license state (as a String), driver’s license number (as an int), telephone number (as a String), credit card type (as a String), and credit card number (as a long). A rental class represents the rental terms for a class of vehicle. For example Compact, Mid-Size, Full Size, Sport etc. are classifications of cars with each time having different rental terms. A rental class should have three pieces of information: a rental class name (as a String), a daily rate (as a double) and a weekly rate (as a double). A vehicle should have four pieces of information: a make/model (as a String), state issuing a tag (as a String), a tag number (as a String) and a rental class (as a rental class). Lastly a rental agreement is the agreement of a customer to rental a given vehicle together with the rental terms, date/time out and date/time in. Thus a rental agreement has 4 pieces of information: the customer, the vehicle, date/time out (as a LocalDateTime) and date/time in.  

For your customer class, provide a constructor accepting values for all instance variables. Provide getter methods for all instance variables except account number, but setter methods for only the telephone, credit card type and credit card number variables.

For rental class class, provide a constructor accepting values for all instance variable. Provide getter methods for all instance variables. Likewise for the vehicle class.

For your rental agreement class provide a constructor accepting values for all instance variables except date/time in as it is intended that this field will be given a value only when the customer returns the vehicle. Provide only getter methods for all instance variables. Provide a setter method for only the date/time in variable.

To represent a date/time use Java’s LocalDateTime class. For this class, however, do not use new to create instances. Instead use the of method:

LocalDateTime dateTimeOut = LocalDateTime.of(2017,1,10, 8, 45);

The above example creates a LocalDateTime for 1/10/2017 at 8:45.

In the rental agreement provide getRentalCharge(), getAirportTax(), getSalesTax() and getTotal() methods. The getRentalCharge() is to return the number of days rented times the daily rental rate. The getAirportTax() is to return the number of days rented times $ 15.00.   The getTax() is to return the rental change times 6%. The getTotal() is to return the sum of rental charge, airport tax, and tax.

In addition to the special get methods, provide a print receipt method that will print the receipt according to the above format.

A day is a 24 hours period. However, there is a one hour grace in returning a car. That is if a car is returned after 24 hours and 59 minutes, then only one day is used in the computations. To compute the number of days between dateTimeOut and dateTimeIn, use the following code:

int noDays = Duration.between(dateTimeOut,dateTimeIn).plusMinutes(23 * 60);


BONUS 5 points: have the computation of rental charge use weekly rate to the best benefit of the customer. The data in the example is using the weekly rate. That is one week charge plus three days at the daily rate.   The weekly rate should be used where it benefits the customer even in cases where it is better than the daily rate. For example if in the example the vehicle was rented 6 days and 1 week rental charges should be used.
                              
In addition, develop another class to test your classes by printing three separate, and different, recepts. This class will have a main method.   In the main method, create instances of your classes in order to print the three separate receipts. Thus, you will hard code inside the main the values to be used when instantiating your classes. With the exception of the fixed values given in the computations above (for example .06 for sales tax rate), do not hard code any other data within your classes. For each receipt instance, call the print method to print the receipt. Make sure to call setDateTimeIn appropriately after creating an instance of a rental receipt and before printing.

NOTE: You do not need, and therefore should not, code any routines to input the values from the user or from files. Your test class is sufficient to demonstrate that your classes are working correctly. If you do the bonus, make sure to have data that will test the logic.

Make sure the instance variables are private. Provide javadoc for each class and methods. Abide by good programming practices.

In: Computer Science

In Linux Professional: PE15 (CH) 1 – why is the max RAM for a 32-bit OS...

In Linux Professional:

PE15 (CH)
1 – why is the max RAM for a 32-bit OS 4 GiB?
2 – virtual memory is called what on Linux? Where is it located?
3 – how many CPU(s) does the VM have?
4 – list all PCI devices; how many of them are there?
5 – Without looking these up, try to spell-out these acronyms:
BIOS, UEFI, SCSI, IDE, SATA, IRQ, DMA, PCI

In: Computer Science

I need C++ code Given the complete main() function, partial playlist class header playlist.h, and playlist.cpp,...

I need C++ code

Given the complete main() function, partial playlist class header playlist.h, and playlist.cpp, you will complete the class declaration and class implementation. The following member functions are required:

  • constructor
  • copy constructor
  • destructor
  • addSong(song tune)
    • adds a single node to the front of the linked list
    • no return value
  • displayList()
    • displays the linked list as formatted in the example below
    • no return value
  • overloaded assignment operator
  • Accessors- search(), delSong()
  • The insertion operator

NOTE: Your linked list class should NOT be templated.

Example: If the input is:

3
Linda Ronstadt
You're no good
2.30
Rock
Elton John
Rocket Man
4.41
Rock
Antonin Leopold Dvorak
Songs my mother taught me
2.24
Classical

where 3 is the number of songs, and each subsequent four lines is an (artist, title, length, genre) record, the output is:

Antonin Leopold Dvorak, Songs my mother taught me, 2.24, Classical
Elton John, Rocket Man, 4.41, Rock
Linda Ronstadt, You're no good, 2.3, Rock

Edit main to demonstrate all implemented functions!

_______________________________________________

#include <iostream>
#include <string>
#include "playlist.h"
using namespace std;

int main()
{
song tune;
string genre;
playlist mySongs;
int num = 0;

cin >> num >> ws;
for (int i=0; i<num; i++)
{
   getline(cin, tune.artist);
   getline(cin, tune.title);
   cin >> tune.length >> ws;
   getline(cin, genre);
   if (genre == "Rock")
   tune.genre = genre_t::ROCK;
   else if (genre == "Country")
   tune.genre = genre_t::COUNTRY;
   else if (genre == "Pop")
   tune.genre = genre_t::POP;
   else if (genre == "Classical")
   tune.genre = genre_t::CLASSICAL;
   else
   tune.genre = genre_t::POLKA;

   mySongs.addSong(tune);
}

mySongs.displayList();

return 0;
}

________________________________________________

#ifndef PLAYLIST_H
#define PLAYLIST_H

#include <iostream>
#include <string>

enum class genre_t {ROCK, COUNTRY, POP, CLASSICAL, POLKA};

struct song
{
std::string artist;
std::string title;
float length;
genre_t genre;
song* next;
};

class playlist
{
public:

// TODO: add the required member functions and operator

private:
song* head;
};

#endif
_________________________________________________________________

#include "playlist.h"

// TODO: implement the class member functions and overloaded operator

In: Computer Science

Write a general-purpose program with loop and indexed addressing that adds 12h to 0th, 3rd ,...

Write a general-purpose program with loop and indexed addressing that adds 12h to 0th, 3rd , 7th , 11th ,15th ,19th , ... elements of a DWORD array. For example, in array:
Array1 DWORD 12h, 13h, 14h,15h, 16h, 17h, 18h, 19h, 1ah, 1bh, 1ch, 1dh, 1eh, 1fh becomes:
Array1 : 24h, 13h, 14h, 27h,16h,17h,18h, 2bh, 1ah, 1bh, 1ch, 2f, 1eh, 1fh

In: Computer Science

Exercise 1: Write a C program that does the following tasks: a. Declare a structure called...

Exercise 1: Write a C program that does the following tasks:

a. Declare a structure called StudRec with four components:

an int containing the StuId,

a string containing the StudName,

a string containing the MajorName,

b. Define typedef List to be a synonym for the type struct StudRec.

c. Declare a global variable array StudST[] of List.

d. Declare a global variable Ptr to be a pointer to List.

e. Write a C function (return pointer to List) that does the following. It accepts the StudST array and an N integer denoting the actual size of the array, read and fill N student details using structure, Dynamic Memory Allocation from the keyboard and return a pointer of List.

f. Declare a structure called Major with two components:

a string containing the MajorName,

an int NumSt containing the number of students in the Major,

g. Declare a global variable array MajorST[] of structure Major.

h. Write a C function that does the following. It accepts the MajorST array with 4 integer denoting the actual size of the array and update the array with 4 MajorName read from the keyboard and assign 0 to NumSt.

i. Write a C function that does the following. It accepts, as arguments, the StudST array (e) with N integer denoting the actual size of the array and the MajorST array (h). Using StudST, the function calculates the number of students in each major and updates the MajorST array by these numbers for each MajorName.

j. Compile and Run the previous statements in a main C file.

In: Computer Science

I need to develop an abstract class/ class that will be called RandString will be used...

I need to develop an abstract class/ class that will be called RandString will be used as a base class for two derived classes: RandStr will generate a random string with 256 characters long and a RandMsgOfTheDay will return a random message the day. (use a table of message in memory - or in a file).


C++, the coding langauge used.

In: Computer Science

How to sort with bubble sort/merge sort with linked lists, only swapping the data not the...

How to sort with bubble sort/merge sort with linked lists, only swapping the data not the nodes (in python)

In: Computer Science

I AM USING R PROGRAMMING LANGUAGE / R- CODE **Problem 3 (5 pts) - similar to...

I AM USING R PROGRAMMING LANGUAGE / R- CODE

**Problem 3 (5 pts) - similar to Pr. 44 page 243 in text** Consider tossing **four** fair coins. There are 16 possible outcomes, e.g `HHHH,HHHT,HHTH,HTHH,THHH, ...` possible outcomes. Define `X` as the random variable “number of heads showing when four coins are tossed.” Obtain the mean and the variance of X. Simulate tossing three fair coins 10,000 times. Compute the simulated mean and variance of X. Are the simulated values within 2% of the theoretical answers?

Hint: to find the theoretical values use `dbinom (x= , size = , prob = )`

**Solution:**YOUR CODE HERE:

```{r}

```

In: Computer Science

Using PYTHON. Implement the stooge sort algorithm3to sort an array/vector of integers. Your program should be...

Using PYTHON. Implement the stooge sort algorithm3to sort an array/vector of integers.

Your program should be able to read inputs from a file called “data.txt” where the first value of each line is the number of integers that need to be sorted, followed by the integers

The output will be written to a file called “stooge.txt”.

Stooge sort is a “bad” recursive sorting algorithm. Given an array A, the algorithm can be defined as follows:

Step 1:

If the value at the leftmost position of the array is larger than the value at the rightmost position then swap values.

Step 2: If there are 3 or more elements in the array, then:

 Recursively call Stooge sort with the initial 2/3 of the array

 Recursively call Stooge sort with the last 2/3 of the array.

 Recursively call Stooge sort with the initial 2/3 of the array again.

Examplevalues for data.txt :

4 19 2 5 11

8 1 2 3 4 5 6 1 2

In: Computer Science

Linux Create two subprocesses using the system call fork(), and then use the system call signal()...

Linux Create two subprocesses using the system call fork(), and then use the system call signal() to let the parent process capture the interrupt signal on the keyboard (i.e., press the DEL key); The subprocess terminates after the subprocess captures the signal and outputs the following information separately: ​ “Child Process l is Killed by Parent!” ​ “Child Process 2 is Killed by Parent!” After the two child processes terminate, the parent process output the following information and terminate itself: ​ “Parent Process is Killed!” Program with screen shot and explanation. Thank you

In: Computer Science

Apex Computing is preparing for a Secret Santa gift exchange. Certain information will be gathered from...

Apex Computing is preparing for a Secret Santa gift exchange. Certain information will be gathered from each employee. Although it would be more realistic to write a program that asks a user for input, this program will just be a practice for using structures and functions so we will create the information by assigning values to the variables.

Write a program that uses a structure named EmpInfo to store the following about each employee:

Name

Age

Favorite Food

Favorite Color

The program should create three EmpInfo variables, store values in their members, and pass each one, in turn, to a function that displays the information in a clear and easy-to-read format. (Remember that you will choose the information for the variables.)

Here is an example of the output:

Name………………………………Mary Smith

Age ……………………………….. 25

Favorite food ………………… Pizza

Favorite color ……………….. Green

In: Computer Science

NEED TO BE IN PYTHON!!! Make sure to put the main section of your code in...

NEED TO BE IN PYTHON!!!

Make sure to put the main section of your code in the following if block:

# Type code for classes here

if __name__ == "__main__":

# Type main section of code here

(1) Build the Account class with the following specifications:

Attributes

  • name (str)
  • account_number (int)
  • balance (float)

Create a constructor that has 3 parameters (in addition to self) that will be passed in from the user. (no default values)

Define a __str__() method to print an Account like the following

Account Name: Trish Duce

Account Number: 90453889

Account Balance: $100.00

Define a deposit() method that has 1 parameter (in addition to self) that will be passed in from the user. (no default values) The method deposits the specified amount in the account.

Define a withdraw() method that has 2 parameters (in addition to self) that will be passed in from the user. (no default values) The method withdraws the specified amount (1st parameter) and fee (2nd parameter) from the account.

(2) In the main section of your code, create 3 accounts.

  • Trish Duce 90453889 100
  • Donald Duck 83504837 100
  • Joe Smith 74773321 100

(3) Print the 3 accounts using print(acct1)…

(4) Deposit 25.85, 75.50 and 50 into accounts 1, 2 and 3.

(5) Print the 3 accounts.

(6) Withdraw 25.85 (2.50 fee), 75.50 (1.50 fee), 50.00 (2.00 fee).

(7) Print the 3 accounts.

Output should look like the following:

Account Name: Trish Duce

Account Number: 90453889

Account Balance: $100.00

Account Name: Donald Duck

Account Number: 83504837

Account Balance: $100.00

Account Name: Joe Smith

Account Number: 74773321

Account Balance: $100.00

Account Name: Trish Duce

Account Number: 90453889

Account Balance: $125.85

Account Name: Donald Duck

Account Number: 83504837

Account Balance: $175.50

Account Name: Joe Smith

Account Number: 74773321

Account Balance: $150.00

Account Name: Trish Duce

Account Number: 90453889

Account Balance: $97.50

Account Name: Donald Duck

Account Number: 83504837

Account Balance: $98.50

Account Name: Joe Smith

Account Number: 74773321

Account Balance: $98.00

In: Computer Science

You will use the definition of the linked-queue from lab6, and re-write it as a template...

You will use the definition of the linked-queue from lab6, and re-write it as a template for a linked-queue (I hope you finished the function definitions)

In the driver file, create and use queues of different types to show it works.

In the documentation, indicate if there are any types it won’t work for, and why not.

driver.cpp

#include <iostream>
using namespace std;

#include "LQueue.h"
void print(Queue q)
{
q.display(cout);
}
int main()
{
Queue q1;
cout << "Queue created. Empty? " << boolalpha << q1.empty() << endl;
cout << "How many elements to add to the queue? ";
int numItems;
cin >> numItems;
for (int i = 1; i <= numItems; i++)
  q1.enqueue(100 * i);
cout << "Contents of queue q1 (via print):\n";
print(q1); cout << endl;
Queue q2;
q2 = q1;
cout << "Contents of queue q2 after q2 = q1 (via print):\n";
print(q2); cout << endl;
cout << "Queue q2 empty? " << q2.empty() << endl;
cout << "Front value in q2: " << q2.front() << endl;
while (!q2.empty())
{
  cout << "Remove front -- Queue contents: ";
  q2.dequeue();
  q2.display(cout);
}
cout << "Queue q2 empty? " << q2.empty() << endl;
cout << "Front value in q2?" << endl << q2.front() << endl;
cout << "Trying to remove front of q2: " << endl;
q2.dequeue();
return 0;
}

LQueue.h

#include <iostream>
#ifndef LQUEUE
#define LQUEUE
typedef int QueueElement;
class Queue
{
public:
/***** Function Members *****/
/***** Constructors *****/
Queue();
/*-----------------------------------------------------------------------
     Construct a Queue object.
      Precondition: None.
       Postcondition: An empty Queue object has been constructed.
            (myFront and myBack are initialized to null pointers).
      -----------------------------------------------------------------------*/
Queue(const Queue & original);
/*-----------------------------------------------------------------------
     Copy Constructor
      Precondition: original is the queue to be copied and is received
           as a const reference parameter.
         Postcondition: A copy of original has been constructed.
      -----------------------------------------------------------------------*/
      /***** Destructor *****/
~Queue();
/*-----------------------------------------------------------------------
     Class destructor
      Precondition: None.
       Postcondition: The linked list in the queue has been deallocated.
    -----------------------------------------------------------------------*/
    /***** Assignment *****/
const Queue & operator= (const Queue & rightHandSide);
/*-----------------------------------------------------------------------
     Assignment Operator
      Precondition: rightHandSide is the queue to be assigned and is
           received as a const reference parameter.
         Postcondition: The current queue becomes a copy of rightHandSide
              and a reference to it is returned.
        -----------------------------------------------------------------------*/
bool empty() const;
/*-----------------------------------------------------------------------
    Check if queue is empty.

       Precondition: None.
       Postcondition: Returns true if queue is empty and false otherwise.
       -----------------------------------------------------------------------*/
void enqueue(const QueueElement & value);
/*-----------------------------------------------------------------------
    Add a value to a queue.

       Precondition: value is to be added to this queue.
       Postcondition: value is added at back of queue.             
       -----------------------------------------------------------------------*/
void display(ostream & out) const;
/*-----------------------------------------------------------------------
    Display values stored in the queue.
       Precondition: ostream out is open.
       Postcondition: Queue's contents, from front to back, have been
       output to out.
       -----------------------------------------------------------------------*/
QueueElement front() const;
/*-----------------------------------------------------------------------
    Retrieve/Peep value at front of queue (if any).

       Precondition: Queue is nonempty.
       Postcondition: Value at front of queue is returned, unless the queue
       is empty; in that case, an error message is displayed and a
       "garbage value" is returned.
       -----------------------------------------------------------------------*/
void dequeue();
/*-----------------------------------------------------------------------
    Remove value at front of queue (if any).
       Precondition: Queue is nonempty.
       Postcondition: Value at front of queue has been removed, unless
       queue is empty; in that case, an error message is displayed
       and execution allowed to proceed.
       -----------------------------------------------------------------------*/
private:
void delete_q(); // utility/helper function to delete queues for
      // destructor and assignment operator
         /*** Node class for the queue***/
class Node
{
public:
  QueueElement data;
  Node * next;
  //--- Node constructor
  Node(QueueElement value, Node * link = 0)
        /*-------------------------------------------------------------------
            Precondition: value and link are received
             Postcondition: A Node has been constructed with value in its
                 data part and its next part set to link (default 0).
                  ------------------------------------------------------------------*/
  {
   data = value; next = link;
  }

}; //for Node class
typedef Node * NodePointer;

/***** Data Members *****/
NodePointer myFront,      // pointer to front of queue
  myBack;                 // pointer to back of queue

}; // end of class declaration
#endif

LQueue-Incomplete.cpp

#include <new>
using namespace std;
#include "LQueue.h"
//--- Definition of Queue constructor
Queue::Queue()
: myFront(0), myBack(0)
{}
//--- Definition of Queue copy constructor
Queue::Queue(const Queue & original)
{
myFront = myBack = 0;
if (!original.empty())
{
  // Copy first node
  myFront = myBack = new Node(original.front());
  // Set pointer to run through original's linked list
  NodePointer origPtr = original.myFront->next;
  while (origPtr != 0)
  {
   myBack->next = new Node(origPtr->data);
   myBack = myBack->next;
   origPtr = origPtr->next;
  } //while
} //if
}
void Queue::delete_q(void) {
// Set pointer to run through the queue
NodePointer prev = myFront, // node to be released/deleted
  ptr; // points to the front node

while (prev != 0)
{
  ptr = prev->next;
  delete prev;
  prev = ptr;
}
}
//--- Definition of Queue destructor
// delete queue from the front
Queue::~Queue()
{
delete_q();
}
//--- Definition of assignment operator
const Queue & Queue::operator=(const Queue & rightHandSide)
{
if (this != &rightHandSide)         // check that not q = q
{
  this->delete_q();               // destroy current linked list

  if (rightHandSide.empty())       // empty queue
   myFront = myBack = 0;
  else
  {                                // copy rightHandSide's list
           // Copy first node
   myFront = myBack = new Node(rightHandSide.front());
   // Set pointer to run through rightHandSide's linked list
   NodePointer rhsPtr = rightHandSide.myFront->next;
   while (rhsPtr != 0)
   {
    myBack->next = new Node(rhsPtr->data);
    myBack = myBack->next;
    rhsPtr = rhsPtr->next;
   }
  }
}
return *this;
}
//--- Definition of empty()
bool Queue::empty() const
{
return (myFront == 0);
}
//--- Definition of enqueue()
void Queue::enqueue(const QueueElement & value)
{
NodePointer newptr = new Node(value);
if (empty())
  myFront = myBack = newptr;
else
{
  myBack->next = newptr;
  myBack = newptr;
}
}
//--- Definition of display()
void Queue::display(ostream & out) const
{
NodePointer ptr;

for (ptr = myFront; ptr != 0; ptr = ptr->next)
  out << ptr->data << " ";
out << endl;
}
//--- Definition of front()
// Peep the first element of the queue
QueueElement Queue::front() const
{
if (!empty())
  return (myFront->data);
else
{
  cerr << "*** Queue is empty "
   " -- returning garbage ***\n";
  QueueElement * temp = new(QueueElement);
  QueueElement garbage = *temp;     // "Garbage" value
  delete temp;
  return garbage;
}
}
//--- Definition of dequeue()
// simply decrement the queue
void Queue::dequeue()
{
if (!empty())
{
  NodePointer ptr = myFront;
  myFront = myFront->next;
  delete ptr;
  if (myFront == 0)     // queue is now empty
   myBack = 0;
}
else
  cerr << "*** Queue is empty -- can't remove a value ***\n";
}

In: Computer Science

Hello, How can we create two buttons in a single page side by side through html?And...

Hello,

How can we create two buttons in a single page side by side through html?And how can we enter different data for different buttons, so that if i click 1st button it should show specific data and if i click second it should show other data?

In: Computer Science

write the program named Lab06.java that contains the following four static methods: • public static double...

write the program named Lab06.java that contains the following four static methods:

• public static double max(double[] data) that returns the maximum value in the array data

• public static double min(double[] data) that returns the minimum value in the array data

• public static double sum(double[] data) that sums all items in the array and return the result

• public static double ave(double[] data) that call the sum() method and then return the average.

Once you have completed the methods above, write a simple main program that does the following:

1. Asks the user how many items will be entered

2. Creates an array of double of the correct size

3. Prompts the user and reads in the values

4. Calculates and prints out the max, min, sum, and average using the methods above.

In: Computer Science