Write an interactive program that prompts for a desired sum

Assignment Help C/C++ Programming
Reference no: EM13333462

Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user:
Desired dice sum: 9
4 and 3 = 7
3 and 5 = 8
5 and 6 = 11
1 and 5 = 6
6 and 3 = 9

Finish the following code file:

importjava.util.*;


public class TestDiceRoll {


public static void main(String[] args) {
Scanner console = new Scanner(System.in);
System.out.print("Desired dice sum: ");
int sum = console.nextInt();


// your code here
}
}

 

Reference no: EM13333462

Questions Cloud

Calculate the present value of each investment : frank Zanca is considering three different investments that his broker has offered to him. the different cash flows are as follows: end of the year    A B C
How much energy appears in the wire : A wire of resistance 9.0 is connected to a battery whose emf script e is 5.0 V and whose internal resistance is 1.0. How much energy appears in the wire as thermal energy in that time
Aggravated assault with a motor vehicle : An assistant county attorney filed a complaint against a man charging him with aggravated assault with a motor vehicle.
Determine the acceleration of the hanging weight : A wheel rotates about a horizontal axis. It has an outer radius R1 = 18.8 cm and mass M1 = 5.12 kg. What is the acceleration of the hanging weight after it is released
Write an interactive program that prompts for a desired sum : Write an interactive program that prompts for a desired sum, then repeatedly rolls two six-sided dice until their sum is the desired sum. Here is the expected dialogue with the user.
Is it a violation of the canons of ethics for an attorney : Is it a violation of the Canons of Ethics for an attorney, who is engaged in the practice of criminal and civil law to be engaged in the business of making bail bonds under an assumed company name and to advertise such business in the telephone di..
Define a class for file that is derived from document : Similarly, define a class for File that is derived from Document and includes a instance variable for the pathname. The textual contents of the file should be stored in the inherited variable text. Redefine the toString method to concatenate all t..
Create a class called vehicle : Create a class called Vehicle that has the manufacturer's name (type String), number of cylinders in the engine (type int), and owner (type Person given below).
Determine the risk-free rate according to capm : the return on the market portfolio is currently 12%. mobile phone corporation stockholders require a rate of return of 30% and the stock has a beta of 3.2. according to capm, DETERMINE THE RISK-FREE RATE.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write program using c language to find page fault

Write program using c language to find page fault for individual processes, group of processes and system as whole using following system call int sys_pgfltstats(pid_t pid,int flag,pf_info_struct *info).

  Create an array of objects from the provided code

Create an array of objects from the provided code and run a for loop to assign strings and numbers. In this assignment, I will need to see the main function. Make sure there is a default constructor.

  Define a class called plot that has private members of lengt

Define a class called Plot that has private members of length and width. Include a constructor and a public function that calculates the area and the length of the boundary of the field.

  Creates a bus class

write a program that creates a bus class. create a constructor that initializes the number of passengers and number of seats. declare four objects. use the default copy constructor to initialize two of the objects.

  Program which opens a data file and displays its content

writing a C++ program which opens a data file and then displays its contents with line numbers. That is the program should display the number 1 and then the first line of the file, then the number 2 and the second line of the file, etc.

  A company that market is publishing both book and audio cass

A company that market is publishing both book and audiocassette versions

  Create a text-based, menu-driven program

Create a text-based, menu-driven program that allows the user to choose whether to add, subtract, multiply or divide two numbers. The program should then input two double values from the use

  Write a program that will call a function

Write a program that will call a function called writeDataToFile to prompt a user for their first name, last name and zip code, and print this information to a file called "UserData.txt". The main function should prompt the user for the same infor..

  Write a program to calculate cars mileage

If you are using VisualStudio 2005, you should include time.h. The call to srand should use the time rather than a number entered by the user and looks like this: srand( static_cast(time( NULL )) ).

  Write a for loop that adds the integers

Assume the int variables i , lo , hi , and result have been declared and that lo and hi have been initialized. Write a for loop that adds the integers between lo and hi (inclusive), and stores the result in result .

  Catch clauses are listed is important

write a program that can be used to demonstrate that the order in which catch clauses are listed is important

  Study on sparse matrix collapse

Discuss in what ways such a structure is similar to and/or different than a list.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd