Questions
Modify the previous program to use the Do-While Loop instead of the While Loop. This version...

Modify the previous program to use the Do-While Loop instead of the While Loop. This version of the program will ask the user if they wish to enter another name and accept a Y or N answer. Remove the "exit" requirement from before.

Output:

Enter the full name of a person that can serve as a reference: [user types: Bob Smith]

Bob Smith is reference #1
Would you like to enter another name (Y or N)? [user types: y]

Enter the full name of a person that can serve as a reference: [user types: Maria Garcia]

Maria Garcia is reference #2
Would you like to enter another name (Y or N)? [user types: N]


You have a total of 2 references

Notes and Hints:

1) You MUST use a DO-WHILE LOOP

2) You must accept the upper and lower case versions of Y and N in the user's reply

3) Hint: That function you used in the previous problem with have a small issue here. That is because there is a newline (Enter) in the keyboard buffer after the user types Y or N. Do you remember how we ignored that extra newline in Chp 3?

Starter Code:

// VARIABLES

// INPUT AND LOOP

std::cout << "Enter the full name of a person that can serve as a reference: ";
  
std::cout << std::endl; // For Mimir
  
std::cout << name << " is reference #" << YOUR_CODE << std::endl;
std::cout << "Would you like to enter another name (Y or N)? ";
  
std::cout << std::endl; // For Mimir

  
// OUTPUT FOR COUNTER
std::cout << std::endl; // So that final line looks nice
std::cout << "You have a total of " <

Previous pogram:

#include<iostream>

using namespace std;


int main()
{
string str;
int refcount=0;


cout<<"Enter the full name of a person that can serve as a reference (type 'exit' to quit): "<<endl;
getline(cin,str);

if(str.compare("exit")==0)
{
refcount=0;
}
else
{
while(str.compare("exit")!=0)
{
refcount++;
cout<<str<<" is reference #"<<refcount<<endl;
cout<< "Enter the name of another person that can serve as a reference (type 'exit' to quit): "<<endl;
getline(cin,str);
  
}

  
}

cout<<"\n\n"<<"You have a total of "<<refcount<<" references\n"<< endl;
return 0;
}

In: Computer Science

Hi guys, I need someone to look over a some codes. My xcoder telling I have...

Hi guys,

I need someone to look over a some codes. My xcoder telling I have error(s), and I need someone to look what causing these errors.

I'm leaving the codes that are giving me errors. I don't want to give my whole code away for privacy reasons. Language is C

1.

#include

#include

#include

#define MAXCHAR 50

/*Here are the structs for the monsters, regions, and commonality.*/

/*typedef struct was provide in instruction*/

typedef struct monster{

int id;

char *name;

char *element;

int popultaion;

}monster;

typedef struct region{

char *name;

int nmonsters;

int total_population;

monster **monsters;

}region;

typedef struct itinerary{

int nregion;

region **region;

int captures;

}itinerary;

typedef struct trainer{

char *name;

itinerary *visits;

}trainer;

/*Monster fill informations. Constructor. */

monster* newCreate( char *name, int popultaion, char *element){

      int gameNam, loveGame;

/*Assigns string to a variable for ease of use.*/

   gameNam = strlen(gameNam) + 1; <------------Here is my error

   loveGame = strlen(loveGame) + 1;<------------Here is my error

   /*Malloc new space.*/

monster *newCreature = (struct monster*)malloc(sizeof(struct monster));

newCreature->name = (char*)malloc(gameNam * sizeof(char));

newCreature->element = (char*)malloc(loveGame * sizeof(char));

/*All struct values will be assigned*/

strncpy(newCreature->name, name, gameNam);

strncpy(newCreature->element, element,loveGame);

newCreature->popultaion = popultaion;

return newCreature;

}

2.

monster** readCreatures(FILE* inFile, int *numbers){

monster **createL, *monster;

char name[MAXCHAR], element[MAXCHAR];

int population;

fscanf(inFile, "%d%*s", numbers);

createL = (struct monster**)malloc(*numbers * (sizeof(struct monster)));

/*This will allow the list to be filled.*/

for(int i=0; i < * numbers; i++){

fscanf(inFile, "%s %s %d", name, element, &population);

creatureList[i] = createL(name, element, population);<------------Here is my error

}

return createL;

}

------------------------

Input file:

8 monstersStAugustine

Grass 12

Zoysia Grass 8

WholeWheat Bread 6

MultiGrain Bread 10

Rye Bread 10

Cinnamon Spice 5

Pepper Spice 10

Pumpkin Spice 303 regions

Rome4 monsters

In: Computer Science

Please Use your keyboard (Don't use handwriting) Thank you.. I need new and unique answers, please....

Please Use your keyboard (Don't use handwriting) Thank you..

I need new and unique answers, please. (Use your own words, don't copy and paste)

Q1:

Your team is asked to program a self-driving car that reaches its destination with minimum travel time.

Write an algorithm for this car to choose from two possible road trips. You will calculate the travel time of each trip based on the car current speed and the distance to the target destination. Assume that both distances and car speed are given.

Q2:

Write a complete Java program that prints out the following information:

  1. Declare String object and a variable to store your name and ID.
  2. DisplayYour Name and Student ID.
  3. Display Course Name, Code and CRN
  4. Replace your first name with your mother / father name.
  5. Display it in uppercase letter.

Note:Your program output should look as shown below.

My Name: Ameera Asiri

My student ID: 123456789

My Course Name: Computer Programming

My Course Code: CS140

My Course CRN: 12345

AIYSHA ASIRI

Note : Include the screenshot of the program output as a part of your answer.

_____

Q3:

Write a tester program to test the given class definition.

Create the class named with your id with the main method.

  1. Create two mobiles M1 and M2 using the first constructor.
  2. Print the characteristics of M1 and M2.
  3. Create one mobile M3 using the second constructor.
  4. Change the id and brand of the mobile M3. Print the id of M3.

Your answer should be supported with the screenshot of the output, else zero marks will be awarded.

public class Mobile

{

int id;

String brand;

public Mobile()

{

id = 0;

brand="";

}

public Mobile(int n, String name)

{

id = n;

brand=name;

}

          public void setBrand(String w)

          {

               brand = w;

           }

          public void setId(int w)

          {

                 id = w;

           }   

         public int getId()

          {

             return id;

            }

          public String getBrand()

         {

               return brand;

          }

}

___

Q4:

Write a method named raiseSalary that accepts two integers as an argument and return its sum multiplied by 15%. Write a tester program to test the method. The class name should be your ID.

Your answer should be supported with a screenshot of the program with output.

In: Computer Science

A shunt-wound DC motor with the field coils and rotor connectedin parallel (see the figure)...

uploaded image

A shunt-wound DC motor with the field coils and rotor connected in parallel (see the figure) operates from a 135 V DC power line. The resistance of the field windings,R_f, is 248Ω. The resistance of the rotor,R_r, is 4.60Ω. When the motor is running, the rotor develops an emf ε. The motor draws a current of 4.94 A from the line. Friction losses amount to 47.0 W.

A) Compute the field current I_f.

I_f= ? A

B) Compute the rotor current I_r.

I_r= ? A

C) Compute the emf EMF.

EMF= ? V

D) Compute the rate of development of thermal energy in the field windings.

P_th,windings= ? W

E) Compute the rate P_th,rotor of development of thermal energy in the rotor.

P_th,rotor= ? W

F) Compute the power input to the motor P_in.

P_in= ? W

G) Compute the efficiency of the motor.

In: Physics

A solution containing 45.00 ml of 0.0500 M metal ion buffered to pH = 10.00 was...

A solution containing 45.00 ml of 0.0500 M metal ion buffered to pH = 10.00 was titrated with 0.0400 M EDTA. Answer the following questions and enter your results with numerical value only.

Calculate the equivalence volume, Ve, in milliliters.

Calculate the concentration (M) of free metal ion at V = 1/2 Ve.

Calculate the fraction (αY4-) of free EDTA in the form Y4-. Keep 2 significant figures.

If the formation constant (Kf) is 1012.00. Calculate the value of the conditional formation constant Kf’ (=αY4- * Kf) and enter your result as scientific notation form.

Calculate the concentration (M) of free metal ion M+ at V = Ve. (Use the Kf' calculated above)

In: Chemistry

The following equation describes the horizontal range of a projectile, fired from a height of zero,...

The following equation describes the horizontal range of a projectile, fired from a height of zero, at an angle of ?θ, with an initial velocity of v:

?= ?^2 sin(2?) / ?,

where g is the acceleration of gravity. Use kinematics to derive this equation by assuming the magnitude of the initial velocity to be v. Hint: the horizontal and vertical components of the initial velocity can be expressed as ??=????(?)vx=vcos(θ) and ??=????(?)vy=vsin(θ). Another hint: you aren't given any numbers but you can still proceed as usual (i.e., find an expression for t using kinematics in the y direction and then plug it into a kinematic equation in the x direction). A third hint: the double angle identity states: sin(2?)=2sin(?)cos(?)

In: Physics

The water in a 40-L tank is to be heated from 15°C to 45°C by a...

The water in a 40-L tank is to be heated from 15°C to 45°C by a 25-cm-diameter spherical heater whose surface temperature is maintained at 85°C. Determine how long the heater should be kept on.

Given: The properties of air at 1 atm and the film temperature of 57.5°C.

Fluid temperature = Average temperature for water (15+45)/2=30°C

k = 0.6515 W/m.°C, v = 0.493 x 10-6 m2/s, Pr = 3.12, and ? = 0.501 x 10-3 K-1

The properties of water at 30°C.
? = 996 kg/m3 and cp = 4178 J/kg.°C, and volume, V = 0.040 m3

In: Mechanical Engineering

A mass of m=1kg of steam is contained in a closed rigid container. Initially the pressure...

A mass of m=1kg of steam is contained in a closed rigid container. Initially the pressure and temperature of the steam are: p1= 1.5 MPa and t1=240?C, respectively. Then the temperature drops to T2 =100?C as the result of heat transfer to the surroundings. Determine: a) quality of the steam at the end of the process, b) percentage of volume that is occupied by the saturated liquid at the final state, c) heat transfer with the surroundings per unit mass of the system. For: p=1.5 MPa and T1=240?C: h1=2900KJ/kg, v1=0.1483 m3/kg while for T2=100?C: h’=419KJ/kg, v’=0.001043m3/kg and h”=2676 KJ/kg ,v”=1.672 m3/kg.

In: Mechanical Engineering

Consider the following cell reaction: Fe(s) + 2 H+(? M) Fe2+(1.00 M) + H2(g)(1.00 atm) If...

Consider the following cell reaction: Fe(s) + 2 H+(? M) Fe2+(1.00 M) + H2(g)(1.00 atm) If the cell potential at 298 K is 0.236 volts, what is the pH of the hydrogen electrode?

A voltaic cell is constructed in which the cathode is a standard hydrogen electrode and the anode is a hydrogen electrode ()= 1atm) immersed in a solution of unknown [H+]. If the cell potential is 0.202 V, what is the pH of the unknown solution at 298 K? pH =

A voltaic cell is constructed in which the cathode is a standard hydrogen electrode and the anode is a hydrogen electrode ()= 1atm) immersed in a solution of unknown [H+]. If the cell potential is 0.184 V, what is the pH of the unknown solution at 298 K?

Thank you!

In: Chemistry

Arteriosclerotic plaques forming on the inner walls of arteries can decrease the effective cross-sectional area of...

Arteriosclerotic plaques forming on the inner walls of arteries can decrease the effective cross-sectional area of an artery. Even small changes in the effective area of an artery can lead to very large changes in the blood pressure in the artery and possibly to the collapse of the blood vessel. Imagine a healthy artery, with blood flow velocity of v 0 =0.14m/s and mass per unit volume of ρ=1050kg/ m 3 . The kinetic energy per unit volume of blood is given by K 0 = 1 2 ρ v 2 0 . Relative to its initial, healthy state, by what factor does the velocity of blood increase as the blood passes through this blockage? Express your answer numerically.

In: Physics