CODE IN C++ :
#include<iostream>
using namespace std;
int main()
{
int first_song;
cout << "Enter the number of minutes to practice first song :
";
cin >> first_song; // time taken by first song
while(first_song < 0) // input until valid time is not
taken
{
cout << "Enter the number of minutes to practice first song :
";
cin >> first_song;
}
int count = 0; // total songs that can be praciced
int next_song; // time taken by next song
cout << "Enter how many more minutes to practice the next
song : ";
cin >> next_song;
while(next_song < 0) // input until valid time is not
taken
{
cout << "Enter the number of minutes to practice the next
song : ";
cin >> next_song;
}
int total; // Total time Victoria has to practice
cout << "Enter the total time (in minutes) to practice all
the songs : ";
cin >> total;
while(total < 0) // Input until valid time is not taken
{
cout << "Enter the total time (in minutes) to practice all
the songs : ";
cin >> total;
}
int time = first_song; // stores how much time each song will
take
int sum = time; // stores the total time taken till now
while(sum <= total)
{
count++;
time += next_song;
sum += time;
}
cout << "In " << total << " minutes Victoria can
practice " << count << " songs." << endl;
}
OUTPUT SNIPPET :
Please give an upvote if you liked my solution. Thank you :)
Objectives: (You must use loop structures to get credit for this assignment) Students in Norfolk Gardens...
03 (20 Marks) A pastry cook is preparing special dishes for her daughter's birthday. It takes her a minutes to prepare the first dish, and each following dish takes b minutes longer than the previous dish. There are a total of t minutes available to prepare the dishes. For example, if the first dish takes a 10 minutes and b 5, then the second dish will take 15 minutes, the third dish will take 20 minutes, and so on. 13.0....
In this assignment, you will implement a class named KaraokeConsole which mimics the console of a karaoke system. This console allows the user to add a new song title to the playlist, play current song move back to previous song title, and move down to next song title. This console, which can hold a maximum of 10 songs, has five buttons: how each button works On/Off, Next, Back, Play, and Add. The table below shows Device Result of pressing a...
PYTHON PROGRAMMING NEED HELP ASAP You will write an application to manage music collections -- a music collection is a list of albums. The named tuples used for Albums and Songs are defined below, and an example of a music collection is given. (DO NOT HARDCODE THE VALUES FOR MUSIC!) Album = namedtuple('Album', 'id artist title year songs') Song = namedtuple('Song', 'track title length play_count') MUSIC = [ Album("1", "Peter Gabriel", "Up", 2002, [Song(1, "Darkness", 411, 5), Song(2, "Growing Up",...
Program: Playlist (C++) I'm having difficulty figuring out how to get the header file to work. You will be building a linked list. Make sure to keep track of both the head and tail nodes. (1) Create three files to submit. Playlist.h - Class declaration Playlist.cpp - Class definition main.cpp - main() function Build the PlaylistNode class per the following specifications. Note: Some functions can initially be function stubs (empty functions), to be completed in later steps. Default constructor (1...
Introduction In this final programming exercise, you'll get a chance to put together many of the techniques used during this semester while incorporating OOP techniques to develop a simple song playlist class. This playlist class allows a user to add, remove and display songs in a playlist. The Base Class, Derived Class and Test Client Unlike the other PAs you completed in zyLabs, for this PA you will be creating THREE Java files in IntelliJ to submit. You will need...
In this assignment, you will be creating a program that requires a secret code to “unlock.” The program should first welcome the user and ask the user to input his/her name. Then the program will greet the user using the entered name. In order to “crack the code,” the user must input three integer numbers which satisfy the following conditions: The first number must be the number 3. The second number can either be the number 1 or be between...
Objectives: 1. Use if, switch, and loop statements 2. Use input and output statements 3. Incorporate functions to divide the program into smaller segments Instructions: Your task is to write a program that simulates a parking meter within the parking deck. The program will start by reading in the time a car arrives in the parking deck. It will then ask you what time the car left the parking deck. You should then calculate the time that has passed between...
Problem C: Walking off the Calories Suppose a person can burn off the 150 calories from a beer by walking for 40 minutes at a moderate pace of 3 miles per hour. Based on the number of beers the user consumes each day, as well as the number of minutes he or she walks each day, determine how much longer the user must walk (both in minutes as well as in hours) in one year to counter the rest of...
use python: Write a program that reads in X whole numbers and outputs (1) the sum of all positive numbers, (2) the sum of all negative numbers, and (3) the sum of all positive and negative numbers. The user can enter the X numbers in any different order every time, and can repeat the program if desired. Sample Run How many numbers would you like to enter? 4 Please enter number 1: 3 Please enter number 2: -4 Please enter...
Assignment #3 Introduction to C Programming-COP 3223 Objectives 1 Togve students practice at typing in, compiling and nunning simple programs. 2 To reinforce knowledge of assignment statements and arithmetic expressions 3. To learn how to use if statements for conditional execution Introduction: Programmers for a Better Tomorrow Programmers for a Better Tomorrow is an organization dedicated to helping charities, medical societies, and scholarship organizations manage various tasks so that they can focus on making the world a better place! They...