Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

WRITE IN JAVA. thank you This program demonstrates the use of characters and strings PLACE YOUR NAME HERE nclude nclude ing namespace std; Definition of

WRITE IN JAVA. thank you image text in transcribed
image text in transcribed
This program demonstrates the use of characters and strings PLACE YOUR NAME HERE nclude nclude ing namespace std; Definition of constants nst string FAVORITESODA = "Dr. Dolittle"; // use double quotes for strings nst char BESTRATING = ' A '; // use single quotes for characters tmain() char rating; /1 2nd highest product rating string favoritesnack; I/ most preferred snack int numberofpeople; // the number of people in the survey int topchoiceTotal; / I the number of people who prefer the top choice If Fill in the code to do the following: 11 Assign the value of "crackers" to favoritesnack 1/ Assign a grade of ' B ' to rating If Assign the number 250 to the numberofpeople I/ Assign the number 148 to the topchoiceTotal If Fill in the blanks of the following: cout "The preferred soda is " endl; cout "The preferred snack is " endi; cout "Out of " people " " chose these items!" endl; cout "Bach of these products were given a rating of " ; cout " from our expert tasters" endi; cout "The other products were rated no higher than a " rating endi; return 0; Task: Retrieve program stringchar.cpp from the Program folder. This program illustrates the use of characters and strings. Using the stringchar.cpp files complete the computer program to demonstrate the use of characters and strings. Write two versions of the program, one in Java and one in C++. Your programs must match your algorithm!!! Input: See source code for instructions. Output: The C++ output should complete the source file. Sample output: The preferred soda is Dr. Dolittle The preferred snack is crackers Out of 250 people 148 chose these items! Each of these products were given a rating of A from our expert tasters The other products were rated no higher than a B

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Jeffrey A. Hoffer Fred R. McFadden

4th Edition

0805360476, 978-0805360479

More Books

Students also viewed these Databases questions