all_convert cpp

all_convert cpp 1

Write a templated function, named “all_convert”, that takes a const reference to a string and a pointer to an int. This function should convert the string to the templated type and return that. It should also adjust the int being pointed to to indicate the number of characters of the string that were converted (be sure to count leading whitespace too).You can assume that the string does not have any newline characters, and your function should ignore leading whitespace (like stoi does).

The user will enter three grades for exam

The user will enter three grades for exam 2

The user will enter three grades for exam, project, and lab.
* The three grades entered will be stated by the program.
* The program will determine and state the highest and the lowest of grade.
* The program will state the grades above or belore 70%
* The program will calculate and display the total grade average.

Mobile Service Provider

Mobile Service Provider 3

Programming Challenge 25: Mobile Service Provider(Page 228)For this program, make sure you include the following modifications- Make sure customer name and billing month is accepted. Billing month should be in the range 1-12. If it is not, please display an error message.- Make sure a user enters only ‘A’, ‘B’ or ‘C’ for the plan package code. Display an error message if any other letter is entered.- Only if a valid package code(‘A’,’B’, or ‘C’) is entered, then the user should be asked to enter the number of gigabytes used- Display a bill with month of bill, customer name, package code, charges included in package deal, and charge for additional data. Make sure you use identifying labels too.For Programming Challenge 25, you will need to send me the cpp file only .

A mobile phone service provider has three different subscription packages for its customers:

Package A: For $39.99 per month 450 minutes are provided. Additional minutes are $0.45 per minute.

Package B: For $59.99 per month 900 minutes are provided. Additional minutes are $0.40 per minute.

Package C: For $69.99 per month unlimited minutes provided.

Write a program that calculates a customer’s monthly bill. It should ask which package the customer has purchased and how many minutes were used. It should then display the total amount due.

Input Validation: Be sure the user only selects package A, B, or C.

FirstLastName

FirstLastName 4

Request a first and last name from the console.
Store each into a separate string variable

.Output the contents of both variables to the console three times:
1) separated by a space
2) separated by a tab
3) separated by a line

The program must precisely match the example output for credit.

For each of the following, write a single c++ statement that performs the specified task

For each of the following, write a single c++ statement that performs the specified task 5

1. For each of the following, write a single c++ statement that performs the
specified task. Assume that floating-point variables number1 and number2 have been
declared and that number1 has been initialized to 7.3. Assume that variable ptr is a type
of char *. Assume that arrays s1 and s2 are each 100-element char arrays that are
initialized with string literals.
a) Declare the variable fPtr to be a pointer to an object of type double.
b) Assign the address of variable number1 to pointer variable fPtr.
c) Print the value of the object pointed to by fPtr.
d) Assign the value of the object pointed to by fptr to variable number2.
e) Print the value of number2.
f) Print the address of number1.
g) Print the address stored in fPtr. Is the value printed the same as the address of
number2?

You are given a file consisting of students’ names

You are given a file consisting of students' names 6

You are given a file consisting of students’ names in the following form: lastName, firstName midddleName. (Note that a student may not have a middle name.) Write a program that converts each name to the following form: firstName middleName lastName. Your program must read student’s entire name in a variable and must consist of a function that takes as input a string, consists of a student’s name, and returns the string consisting of the altered name. Use the string function find to find the inex of ,; the function length to find the length of the string; and the function substr to extract the firstName, middleName, and lastName.

The input file looks like this:
Miller, Jason Brian
Blair, Lisa Maria
Gupta, Anil Kumar
Arora, Sumit Sahil
Saleh, Rhonda Beth

Write a program that displays the contents of a file in four columns

Write a program that displays the contents of a file in four columns 7

Write a program that displays the contents of a file in four columns titled “Item Name”, “Num of Items”, “Item Price”, “Total”. The total is the is the quantity of each item sold multiplied by the item price. This program should not use an array. However, it should read all values from file named “itemFile.txt”, perform calculations where possible, and display everything in the C++ output window. The program should also calculate the total price of all items sold. Copy the contents of your file and paste them below your program. Submit your program together with the output.

Suppose that one of the biggest car sales companies

Suppose that one of the biggest car sales companies 8

Suppose that one of the biggest car sales companies promised you an offer. Therefore, they
have requested that you write a simple program that will help to assign a code consisting of only
three characters. The first character is either the letter L which indicates that the employee
deserves the certificate for long-term service, or the letter I which indicates that an employee is
still an intern. The second character is either 3 indicating that the employee works at a dispatch
department or 4 indicating that the employee works as a salesperson. Write a program that
requests the user to enter the code (L3, L4, I3, I4). The program should open the file named
“Employeecode.txt’, search the for the code, and display only the names of the employees
assigned to that code. E.g. if an employee works at a dispatch department with an employee
code as “L3A#John Uka”, then only John Uka should be displayed. The program must test
only the first two characters. Should the user enter an invalid code, then the appropriate error
message must be displayed.

calAverage CPP

calAverage CPP 9

Suppose the owner of truck shop gave you a file that contains the list of items, the number of items sold, and the price of each item in a week. You are requested to write a program that will calculate the total and average price of all the items sold. The program will then output the name of an item, weekly total price of each item, and the average price of all items. Furthermore, the program should display the names of all items that have a total price greater than the average price. Your program should have only the following functions:

main function that calls all the functions except the calAverage function

void getItemData that reads data from a file

void calculateTotal that calculates the total amount for each item

void print that displays the name of items, number of items, price per item, and total price

double calcAverage that calculates the average

void calcAverageGreater that calls calcAverage, displays average and items whose total price is greater than average

You should use two parallel arrays: a one-dimensional array to store all the names of the items and a two-dimensional array to store number of items sold in a week, and the prices for items as indicated in the table below:

Items Number of Items Prices
Milk 60 12.50
Cabbage 17 14.25
Cremora 9 24.50
Soap 25 17.50
Rama 55 10.50
Bananas 40 18.75
Pears 45 4.50
Drinks 60 20.00
Oranges 65 18.75
Lotions 30 9.75
Lettuce 21 11.50
Sugar 24 30.08
Lemons 11 18.60

printResults CPP

printResults CPP 10

Write a program that reads a text and outputs the letters, together with their counts, as explained below in the function printResults. Your program should not have any global variables. All information should be accessed through the parameters of the functions. Your program should have at least the following functions.

Function main – calls all the functions

Function openFile – opens the input and output files. This program has the file stream declare a reference parameter. An appropriate error message should be displayed if the file does not exist. The program must ask the user for the names of the input and output files.

Function countLetters – counts every uppercase letters A – Z and lower-case letters from a-z in the next text file opened in the function openFile. This information should be stored in an array of structures. Both the array and file identifiers must be passed as parameters.

Function printResults – prints the number of uppercase letters for every occurence of A-Z and the percentage of lower-case letters for every occurance of a-z. The percentage should look like this: “25%”. This information must come from an array structures, and must be passed as a parameter

Hint: Use a structure to store the information.

×
New Download