But how do I ask user to choose a number and previous prime before that and after is displayed. And how many integers are in there depending on user input number?
Problem 6: Write a program that asks for the number of calories and fat grams in a food. The program should display the percentage of calories that come from fat. If the calories from fat are less than 30% of the total calories of the food, it should also display a message indicating that the food is low in fat.
One gram of fat has 9 calories, so
Calories from fat = fat grams * 9
The percentage of calories from fat can be calculated as Calories from fat x total calories
This assignment requires a C++ program be written to perform a vote counting and tallying procedure to gauge favorite holiday destinations of individuals. It should present the user with the question and a “ballot” of 5 holiday destinations and an exit/quit option. Once the program is started, it should allow the user to vote multiple times (same as in multiple users using the program to vote). The program should start with a program title and brief instructions on how to vote. It should then ask the user to select an item (vote) from a group of items that are presented. You should use your own choice of holiday destinations
Write a C++ program to check the duplicate mobile number by throwing a custom exception.
The class named ContactDetail with the following private member variables
Data typeVariable namestringmobilestringalternateMobilestringemail
In ContactDetail class include the following member function
Member FunctionDescriptionvoid display() This function is used to display the contact details
Create a class named ContactDetailBO with the following member function
Method nameDescriptionbool validate(ContactDetail cd) This method is used to validate whether the mobile number and alternate mobile number are not the same. If both are the same, then it throws DuplicateMobileNumber Exception. Otherwise, return true to print the details.Class named DuplicateMobileNumberException thatextends exception class and create
a method to return the following message "DuplicateMobileNumberException".
Write a C++ program on If you have a musical friend, you next need to check (using a nested if statement) that they actually play an instrument you want in the band. You decide that they need to play either guitar or drums to join.
Problem 4: Fibonacci Series always starts with 0 and 1, or in other words the first two terms of this series are 0 and 1. Next term in this series is found by adding two previous numbers. Following figure shows first 6 terms of the Fibonacci Series i.e. 0, 1, 1, 2, 3, 5, if we were to print only even numbers then the output will be 0, 2.
Design the algorithm (pseudocode) for a program that prints even terms in Fibonacci series less than N. Where N is the number entered by the user. For example,
If N is 75 then print 0, 2, 8, 34 (i.e. all even terms in Fibonacci series that are less than 20)
If N is 20 then print 0, 2, 8 (i.e. all even terms in Fibonacci series that are less than 20)
If N is 6 then print 0, 2 (i.e. all even terms in Fibonacci series that are less than 6)
Name Q1 Q2 Q3 Q4 Q5
Jean
Mark
Von 20
Ben
Jessie
Yno
Problem 3: A bookseller has a book club that awards points to its customers based on the number of books purchased each month. The points are awarded as follows:
If a customer purchases 0 books, he or she earns 0 points.
If a customer purchases 1 book, he or she earns 5 points.
If a customer purchases 2 books, he or she earns 15 points.
If a customer purchases 3 books, he or she earns 30 points.
If a customer purchases 4 or more books, he or she earns 60 points.
Write a pseudocode program that asks the user to enter the number of books that he or she has purchased this month and then displays the number of points awarded
You have been contracted to design a system for a smart car. The company installed four laser radars on the car’s corners to use as sensors, for the car to be able to avoid collisions at the rear, and the front.
Using a flowchart, show the algorithm for the car collision avoidance system.
Using any recommended programming language of your choice, write a source code for the car collision avoidance system