CS代写|c++代写|C代写-Assignment #1

CS代写/c++代写/C代写:这是一个基础的C代写和C++代写,是基础的编程训练
Assignment #1
For all Programs:
To get in the habit of writing pseudocode write the simple pseudocode for these
programs. The pseudocode for #1 for example can be as simple as “Display Student
Information on Screen formatted on 4 Lines”. Put your pseudocode in comments at
the top of your programs, as well as many lines within the code necessary to describe
what’s going on in the program. PSEUDOCODE IS REQUIRED FOR ALL
PROGRAMS.

For this first homework you have five SHORT programs, so you will be submitting 5
source files via Canvas. Future homework assignments will not have this many
programs involved; these are simple programs. That is the only reason there are so
many programs for this assignment. These programs address the basics from Chapters
1 – 4.
Student Information Program
1. Write a program that displays the following information about yourself: your
name, the computer languages you know (you can write “none”), your favorite
video game, and what 3 people/characters, real or imaginary, living or dead, .
You should format your program output similar to the output below (make sure
and use your own name and information):
STUDENT INFORMATION
————————————
NAME: Jane Doe
COMPUTER LANGUAGES: Java, HTML
FAVORITE VIDEO GAME: Call of Duty
WHO I WOULD HAVE DINNER WITH: John Doe, Mickey Mouse, Bono
CS 52 – Spring 2018 E. Ambrosio
2
From Chapters 2 and 3
2. Write a C++ program that produces a simple personalized adventure game
called Lost Fortune about a band of explorers that finds a stash of 750 gold
pieces. Start by asking the player for the following information: the number of
explorers and the number of explorers lost in battle. The program should then
use the information input by the player (this information will be different EACH
time the game is played) to generate and print a basic adventure story. Here’s a
sample run of the input and output of the game (program) where the player
entered the following input: 17 (for the number of explorers), followed by 13 (for
the number of explorers lost).
Welcome to Lost Fortune!
Please answer the following questions for your personalized adventure:
Enter the number of Explorers:
17
Enter the number of Explorers Lost in Battle:
13
You bravely led 17 adventurers on a quest for gold.
The group fought a band of ogres and lost 13 members.
Only 4 survived.
The party was about to give up when they stumbled upon the buried
fortune of 750 gold pieces. The group split the loot evenly and as the
quest leader you kept the extra 2 gold pieces.
Note the game must work correctly no matter what number of explorers and lost
explorers the player inputs. Therefore, in addition to using the values that the
player provides, the program needs to calculate the number of remaining
explorers after the battle and the number of extra gold pieces the player keeps
after the gold pieces are divided evenly between the surviving explorers (in the
above example each of the 4 surviving explorers got 187 gold pieces and the two
remaining pieces that couldn’t be divided evenly between the 4 explorers go to
the player (quest leader)).
CS 52 – Spring 2018 E. Ambrosio
3
3. Write a C++ program that creates an invoice for a small fruit vendor named
“Bob’s Fruits”. The fruit vendor sells three kinds of fruit: oranges, apples, and
bananas. Oranges cost .90 each, apples cost .65 each and bananas cost .70
each. For each type of fruit the program should ask the user how many of this
type of fruit they would like to purchase (zero is an acceptable answer). After
obtaining the purchase information from the user display an invoice on the
screen similar to this:
BOB’S FRUITS GROCERY INVOICE
————————————————–
20 Apples @ 0.65 each = $ 13.00
20 Oranges @ 0.90 each = $ 18.00
20 Bananas @ 0.70 each = $ 14.00
————————————————–
TOTAL = $ 45.00
This invoice is an example of the case where a user buys 20 oranges, 20 apples
and 20 bananas. Make sure and use symbolic constants where appropriate in
your program and make sure to format your numeric output.
Deposits with Interest Program
4. Write a C++ program that accepts an amount of money on deposit and a number
of years it has been on deposit (years can have decimals). It will determine the
interest to be paid on the deposit based on the following schedule:
Time on Deposit Interest Rate
>= 5 years 4.5%
Less than 5 and >=4 years 4%
Less than 4 and >=3 years 3.5%
Less than 3 and >=2 years 2.5%
Less than 2 and >=1 years 2%
Less than 1 year 1.5%
Compute the interest with the formula: Interest = Deposit * IntRate * Years.
Display the original deposit, the interest earned and the new Balance (with interested
added to the deposit.
CS 52 – Spring 2018 E. Ambrosio
4
Pet Insurance Program
5. Write a program that prints the insurance fee to pay for a pet according to the
following rules:
(NOTE: You must use a switch statement to determine pet fee.)
A dog that has been neutered costs $50.
A dog that has not been neutered costs $80.
A cat that has been spayed costs $40.
A cat that has not been spayed costs $60.
A bird or reptile costs nothing.
Any other animal generates an error message.
The program should prompt the user for the appropriate information: a character code
for the pet type, and a yes/no response for the neutered status. Use a code letter to
determine the kind of animal (i.e. D or d represents a dog, C or c represents a cat, B or
b represents a bird, R or r represents a reptile, and anything else represents some other
kind of animal). Use a code letter to determine the neutered/spayed status (i.e. Y or y
represents yes, N or n represents no). The user should be allowed to enter the input in
either upper or lower case.
It prints out the type of animal (full name of animal) and the insurance fee. Any error in
input data should generate an error message “Invalid data – no fee calculated”.

发表评论

电子邮件地址不会被公开。 必填项已用*标注