Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function that inserts a new element at the beginning of an array. It sho

ID: 3694314 • Letter: W

Question

Write a function that inserts a new element at the beginning of an array. It should take in the array, the array size, and the element to be inserted.

3.3 Create a struct to represent a website. It should store the site’s common name, its IP address, how many visits per day it receives, and whether or not the site is trusted. 4

3.4 Write a function to update the struct defined above. It should take in the total site visits for a year, and how many complaints they received. It should update the website information with the new visits per day, and if over 30% of the visits cause reports, label the website as untrusted.

3.5 Write the definition for a BankAccount class. It should contain an id number, an account balance, an account holder name, and a current interest rate as member variables. As member functions, it should have a default constructor, and a set function for each variable. It should also have a private function named update balance. You do not have to give code for these functions, just define them as part of the function.

3.6 Implement the update balance function. It should take no arguments and return nothing. It should look at the current interest rate and adjust the current balance accordingly.

c++

Explanation / Answer

3.2)

void array_insert(int arr[],int size,int ele){
   for(int i=0;i<size-1;i++){
       arr[i+1]=arr[i];
   }
   arr[0]=ele;
}

3.3)

struct website{
   string name;
   string ip_address;
   int visits;
   bool trusted;
};

3.4)

void update(website w,int v,int c){
   w.visits=v;
   if(((c*0.1)/(v*0.1))>0.3){
       trusted=false;
   }
}

3.5)

class BankAccount{
   int id;
   float balance;
   string name;
   float int_rate;
public:
   BankAccount(){
       id=0;
       balance=0;
       name="";
       int_rate=0;
   }
   void set_id(int id);
   void set_balance(float balance);
   void set_name(string name);
   void set_rate(float int_rate);
private:
3.6)

void update_balance(){
       balance=balance+((int_rate/100)*balance);
   }

};

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote