Question

In: Computer Science

We will be creating an application that will allow the user to enter an order, delete...

We will be creating an application that will allow the user to enter an order, delete an order, or display the total of all orders in the system.

Create a new .NET Frameword Console Application project in Visual Studio called “OrderTest.” Rename the Program.cs file to OrderTest.cs.

Inside the OrderTest class, but outside of the Main method, create a new static Random object.

Add a class to the project and call it “Order.” In Order there should be a static decimal named Total available for public access. There should also be the following members:

CustomerName (string)
OrderNum(int)
SubTotal(decimal)
Item1(string)
Item2(string)
Item3(string)
Item4(string)

Each of the members in Order should have the appropriate get and set properties. You can use the auto-implementation of the properties, or create the instance variables and the properties separately.

In Order create a method called “DisplayOrder” that uses all of the properties created in step 4 to print the order out to the console. There should also be a default constructor and a constructor that takes 7 arguments used to initialize the members of the class.

In OrderTest class create two static methods: One called UpdateTotal that takes a decimal as an argument. This method will update the static Total variable of the Order class, so the decimal passed to the method is added to Total. The second static method should be called DisplayTotal. This method takes no arguments but prints the Total from the Order class out to the console when called.

In the Main method of OrderTest declare the following:

selection(char)
orderEdit(int)
oNum(int)
endMenu(bool) initialized to false

Create 3 objects of the Order class called order1, order2, and order3. The first two should use the constructor that takes the 7 arguments as follows: (378, "Bon", "Yeriyaki", "Rice", "Pudding", "Butter", 59.25M) and (124, "Meat", "Celery", "Pasta", "Soup", "Lemonade", 49.35M). Immediately after creating these objects you should add the SubTotal of each order to the Total of the Order class. Use the method created in Step 6 to accomplish this. If working correctly then the following code is how this will be accomplished…

Order.Total = UpdateTotal(order1.SubTotal);

The third object should use the default constructor.

Prompt the user with the following info asking them to make a selection. Replace the name "Abigail" with your own name:

Welcome to Abigail's Restaurant!
Please make a selection below...
a) Begin an order
b) Delete an order
c) Display Total of All orders
d) Exit
10.) The user input should be assigned to the "selection" char variable declared earlier. The "selection" should then be checked in a switch statement.

If 'a' is typed in then use the "Next()" method of the Random object with an argument of 1000 to generate a random number between 0 and 999. This random number should be assigned to the oNum variable. This is the OrderNum of the order3 object created. Prompt the user to enter the customer name (with no spaces), items 1-4, (with no spaces), and a price for each item. Every time a price is entered add it to the SubTotal member of the order3 object. Once all of the info has been entered and assigned to the members of the object, call the UpdateTotal method with order3.SubTotal as the argument. Then call the DisplayOrder method of the order3 object.

If the user enters 'b' then ask the user if they wish to delete order 1 or order 2. The entered value should be assigned to the orderEdit variable. Use an if/else statement on the orderEdit variable to decide which of the orders to delete. You will not delete the order but set all of the order's string values to "", subtract the SubTotal amount from the static Total in the Order class, and then set the SubTotal amount of the order to 0.00. Call the DisplayOrder method on whichever order has been deleted.

If the user enters 'c' call the DisplayTotal method.

If the user enters 'd' print out "Leaving" to the console and set the endMenu variable to true.

The default of the switch should prompt the user to please try again.

The entire menu display and switch statement should be enclosed in a do/while statement that executes until the endMenu variable is set to true.

for C#

Solutions

Expert Solution

ASP.NET is a MVC Framework. It contains hundreds of files. We will need to edit controllers. Understanding the flow of code is required as each controller is connected. Similarly, route parameters are set same way. Through textual form, understanding MVC is hard t explain but if we need to understand the logic behind,

Login Model:

using SimpleInventory.Helpers;

using SimpleInventory.Interfaces;

using SimpleInventory.Models;

using System;

using System.Collections.Generic;

using System.Linq;

using System.Runtime.InteropServices;

using System.Security;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Input;

namespace SimpleInventory.ViewModels

{

    class LoginViewModel : BaseViewModel

    {

        private string _username;

        private SecureString _password;

        private string _error;

        public LoginViewModel(IChangeViewModel viewModelChanger) : base(viewModelChanger)

        {

        }

        public string Username

        {

            get { return _username; }

            set { _username = value; NotifyPropertyChanged(); }

        }

        public SecureString Password

        {

            private get { return _password; }

            set { _password = value; NotifyPropertyChanged(); }

       }

        public string Error

        {

            get { return _error; }

            set { _error = value; NotifyPropertyChanged(); }

        }

        public ICommand AttemptLogin

        {

            get { return new RelayCommand(TryLogin); }

        }

        private void TryLogin()

        {

            if (string.IsNullOrWhiteSpace(Username))

            {

                Error = "Username is required";

            }

            else if (Password == null)

            {

                Error = "Password is required";

            }

            else

            {

                var user = User.LoadUser(Username, Utilities.SecureStringToString(Password));

                if (user != null)

                {

                    Username = "";

                    Password.Clear();

                    Error = "";

                    PushViewModel(new HomeScreenViewModel(ViewModelChanger) { CurrentUser = user });

                }

                else

                {

                    Error = "Invalid username or password";

                }

            }

        }

    }

}

The below code is implementation to add orders.(with getter and setters defined as required in the question)

using SimpleInventory.Helpers;
using SimpleInventory.Interfaces;
using SimpleInventory.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
 
namespace SimpleInventory.ViewModels
{
    class CreateOrEditItemViewModel : BaseViewModel
    {
        private bool _isCreating;
        private int _inventoryItemID;
        private string _screenTitle;
 
        private string _name;
        private string _description;
        private string _cost;
        private string _profitPerItem;
        private string _costToPurchase;
        private int _numberOfItemsInPack;
 
        private int _indexOfDefaultCurrency;
        private int _selectedCostCurrencyIndex;
        private int _selectedProfitCurrencyIndex;
        private int _selectedCostToPurchaseCurrencyIndex;
        private int _selectedItemTypeIndex;
 
        private int _quantity;
        private string _barcodeNumber;
 
        private InventoryItem _currentItemBeingEdited;
        private ICreatedInventoryItem _createdItemListener;
 
        private List<Currency> _currencies;
        private List<ItemType> _itemTypes;
 
        public CreateOrEditItemViewModel(IChangeViewModel viewModelChanger, ICreatedInventoryItem createdItemListener) : base(viewModelChanger)
        {
            _isCreating = true;
            _currencies = Currency.LoadCurrencies();
            _itemTypes = ItemType.LoadItemTypes();
            _currentItemBeingEdited = null;
            SetupCurrencyIndices();
            SetupItemTypeSelection();
            Name = "";
            Description = "";
            Cost = "0";
            ProfitPerItem = "0";
            Quantity = 0;
            BarcodeNumber = "";
            _createdItemListener = createdItemListener;
            ScreenTitle = "Add Item";
        }
 
        public CreateOrEditItemViewModel(IChangeViewModel viewModelChanger, InventoryItem item) : base(viewModelChanger)
        {
            _isCreating = false;
            _currentItemBeingEdited = item;
            _inventoryItemID = item.ID;
            _currencies = Currency.LoadCurrencies();
            _itemTypes = ItemType.LoadItemTypes();
            SetupCurrencyIndices(item);
            SetupItemTypeSelection(item);
            Name = item.Name;
            Description = item.Description;
            Cost = item.Cost.ToString();
            ProfitPerItem = item.ProfitPerItem.ToString();
            Quantity = item.Quantity;
            BarcodeNumber = item.BarcodeNumber;
            NumberOfItemsInPack = item.ItemsPerPurchase;
            CostToPurchase = item.ItemPurchaseCost.ToString();
            ScreenTitle = "Edit Item";
        }
 
        #region Properties
 
        public string ScreenTitle
        {
            get { return _screenTitle; }
            set { _screenTitle = value; }
        }
 
        public List<Currency> Currencies
        {
            get { return _currencies; }
        }
 
        public List<ItemType> ItemTypes
        {
            get { return _itemTypes; }
        }
 
        public string Name
        {
            get { return _name; }
            set { _name = value; NotifyPropertyChanged(); }
        }
 
        public string Description
        {
            get { return _description; }
            set { _description = value; NotifyPropertyChanged(); }
        }
 
        public string Cost
        {
            get { return _cost; }
            set { _cost = value; NotifyPropertyChanged(); }
        }
 
        public int SelectedCostCurrencyIndex
        {
            get { return _selectedCostCurrencyIndex; }
            set { _selectedCostCurrencyIndex = value; NotifyPropertyChanged(); }
        }
 
        public string ProfitPerItem
        {
            get { return _profitPerItem; }
            set { _profitPerItem = value; NotifyPropertyChanged(); }
        }
 
        public int SelectedProfitCurrencyIndex
        {
            get { return _selectedProfitCurrencyIndex; }
            set { _selectedProfitCurrencyIndex = value; NotifyPropertyChanged(); }
        }
 
        public int SelectedItemTypeIndex
        {
            get { return _selectedItemTypeIndex; }
            set { _selectedItemTypeIndex = value; NotifyPropertyChanged(); }
        }
 
        public int Quantity
        {
            get { return _quantity; }
            set { _quantity = value; NotifyPropertyChanged(); }
        }
 
        public string BarcodeNumber
        {
            get { return _barcodeNumber; }
            set { _barcodeNumber = value; NotifyPropertyChanged(); }
        }
 
        public bool IsCreating
        {
            get { return _isCreating; }
            set { _isCreating = value; NotifyPropertyChanged(); }
        }
 
        public string CostToPurchase
        {
            get { return _costToPurchase; }
            set { _costToPurchase = value; NotifyPropertyChanged(); }
        }
 
        public int NumberOfItemsInPack
        {
            get { return _numberOfItemsInPack; }
            set { _numberOfItemsInPack = value; NotifyPropertyChanged(); }
        }
 
        public int SelectedCostToPurchaseCurrencyIndex
        {
            get { return _selectedCostToPurchaseCurrencyIndex; }
            set { _selectedCostToPurchaseCurrencyIndex = value; NotifyPropertyChanged(); }
        }
 
        #endregion
 
        #region ICommands
 
        public ICommand PopBack
        {
            get { return new RelayCommand(PopToMainMenu); }
        }
 
        private void PopToMainMenu()
        {
            PopViewModel();
        }
 
        public ICommand SaveItem
        {
            get { return new RelayCommand(CreateOrSaveItem); }
        }
 
        #endregion
 
        private void SetupCurrencyIndices(InventoryItem item = null)
        {
            var didSetCostCurrencyIndex = false;
            var didSetProfitCurrencyIndex = false;
            var didSetCostToPurchaseCurrencyIndex = false;
            for (int i = 0; i < _currencies.Count; i++)
            {
                var currency = _currencies[i];
                if (currency.IsDefaultCurrency)
                {
                    _indexOfDefaultCurrency = i;
                    if (item == null)
                    {
                        _selectedCostCurrencyIndex = i;
                        _selectedProfitCurrencyIndex = i;
                        _selectedCostToPurchaseCurrencyIndex = i;
                        didSetCostCurrencyIndex = didSetProfitCurrencyIndex = true;
                    }
                }
                if (item != null)
                {
                    if (item.CostCurrency != null && item.CostCurrency.ID == currency.ID)
                    {
                        _selectedCostCurrencyIndex = i;
                        didSetCostCurrencyIndex = true;
                    }
                    if (item.ProfitPerItemCurrency != null && item.ProfitPerItemCurrency.ID == currency.ID)
                    {
                        _selectedProfitCurrencyIndex = i;
                        didSetProfitCurrencyIndex = true;
                    }
                    if (item.ItemPurchaseCostCurrency != null && item.ItemPurchaseCostCurrency.ID == currency.ID)
                    {
                        _selectedCostToPurchaseCurrencyIndex = i;
                        didSetCostToPurchaseCurrencyIndex = true;
                    }
                }
            }
            if (!didSetCostCurrencyIndex)
            {
                _selectedCostCurrencyIndex = _indexOfDefaultCurrency;
            }
            if (!didSetProfitCurrencyIndex)
            {
                _selectedProfitCurrencyIndex = _indexOfDefaultCurrency;
            }
            if (!didSetCostToPurchaseCurrencyIndex)
            {
                _selectedCostToPurchaseCurrencyIndex = _indexOfDefaultCurrency;
            }
        }
 
        private void SetupItemTypeSelection(InventoryItem item = null)
        {
            int indexOfDefaultItemType = -1;
            bool didSet = false;
            for (int i = 0; i < _itemTypes.Count; i++)
            {
                var itemType = _itemTypes[i];
                if (itemType.IsDefault)
                {
                    indexOfDefaultItemType = i;
                    if (item == null)
                    {
                        SelectedItemTypeIndex = i;
                        didSet = true;
                        break;
                    }
                }
                else if (item != null && item.Type != null && item.Type.ID == itemType.ID)
                {
                    SelectedItemTypeIndex = i;
                    didSet = true;
                    break;
                }
            }
            if (!didSet)
            {
                SelectedItemTypeIndex = indexOfDefaultItemType;
            }
        }
 
        private void CreateOrSaveItem()
        {
            var item = _currentItemBeingEdited != null ? _currentItemBeingEdited : new InventoryItem();
            // validate
            bool didValidate = true;
            string errorMessage = "";
            if (!string.IsNullOrWhiteSpace(BarcodeNumber))
            {
                var loadedItem = InventoryItem.LoadItemByBarcode(BarcodeNumber);
                if (loadedItem != null && (_isCreating || (!_isCreating && _inventoryItemID != loadedItem.ID)))
                {
                    didValidate = false;
                    errorMessage = "Barcode already exists for item named " + loadedItem.Name;
                }
            }
            if (didValidate)
            {
                // create/save
                item.Name = Name;
                item.Description = Description;
                item.Type = _selectedItemTypeIndex != -1 ? _itemTypes[_selectedItemTypeIndex] : null;
                decimal cost = 0m;
                bool didParse = Decimal.TryParse(Cost, out cost);
                item.Cost = didParse ? cost : 0m;
                item.CostCurrency = _currencies[_selectedCostCurrencyIndex];
 
                decimal profit = 0m;
                didParse = Decimal.TryParse(ProfitPerItem, out profit);
                item.ProfitPerItem = didParse ? profit : 0m;
                item.ProfitPerItemCurrency = _currencies[_selectedProfitCurrencyIndex];
 
                decimal costToPurchase = 0m;
                didParse = Decimal.TryParse(CostToPurchase, out costToPurchase);
                item.ItemPurchaseCost = didParse ? costToPurchase : 0m;
                item.ItemPurchaseCostCurrency = _currencies[_selectedCostToPurchaseCurrencyIndex];
                item.ItemsPerPurchase = NumberOfItemsInPack;
 
                item.BarcodeNumber = BarcodeNumber;
                item.PicturePath = "";
                if (_isCreating) // any further adjustments have to be made via the adjust quantity screen
                {
                    item.Quantity = Quantity;
                }
                var userID = CurrentUser != null ? CurrentUser.ID : 1;
                item.CreatedByUserName = CurrentUser != null ? CurrentUser.Name : "";
                if (_isCreating)
                {
                    item.CreateNewItem(userID);
                    QuantityAdjustment.UpdateQuantity(Quantity, item.ID, userID, "Initial quantity", false);
                    _createdItemListener?.CreatedInventoryItem(item);
                }
                else
                {
                    item.ID = _inventoryItemID;
                    item.SaveItemUpdates(userID);
                }
                PopViewModel();
            }
            else if (!string.IsNullOrWhiteSpace(errorMessage))
            {
                MessageBox.Show(errorMessage, "Error!", MessageBoxButton.OK);
            }
        }
    }
}

The below code will help you to manage orders and show total.

using SimpleInventory.Helpers;
using SimpleInventory.Interfaces;
using SimpleInventory.Models;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Windows.Input;
 
namespace SimpleInventory.ViewModels
{
    class ManageItemsViewModel : BaseViewModel, ICreatedInventoryItem
    {
        private ObservableCollection<InventoryItem> _items;
        private int _selectedIndex = 0;
        private InventoryItem _selectedItem;
 
        private bool _isItemSelected;
 
        public ManageItemsViewModel(IChangeViewModel viewModelChanger) : base(viewModelChanger)
        {
            Items = new ObservableCollection<InventoryItem>(InventoryItem.LoadItemsNotDeleted());
            IsItemSelected = false;
        }
 
        public ObservableCollection<InventoryItem> Items
        {
            get { return _items; }
            set { _items = value; NotifyPropertyChanged(); }
        }
 
        public bool IsItemSelected
        {
            get { return _isItemSelected; }
            set { _isItemSelected = value; NotifyPropertyChanged(); }
        }
 
        public int SelectedIndex
        {
            get { return _selectedIndex; }
            set { _selectedIndex = value; NotifyPropertyChanged(); IsItemSelected = value != -1; }
        }
 
        public InventoryItem SelectedItem
        {
            get { return _selectedItem; }
            set { _selectedItem = value; NotifyPropertyChanged(); }
        }
 
        public ICommand MoveToAddItemScreen
        {
            get { return new RelayCommand(LoadAddItemScreen); }
        }
 
        private void LoadAddItemScreen()
        {
            PushViewModel(new CreateOrEditItemViewModel(ViewModelChanger, this) { CurrentUser = CurrentUser });
        }
 
        public ICommand MoveToEditItemScreen
        {
            get { return new RelayCommand(LoadEditItemScreen); }
        }
 
        private void LoadEditItemScreen()
        {
            if (SelectedItem != null)
            {
                PushViewModel(new CreateOrEditItemViewModel(ViewModelChanger, SelectedItem) { CurrentUser = CurrentUser });
            }
        }
 
        public ICommand MoveToAdjustQuantityScreen
        {
            get { return new RelayCommand(LoadAdjustQuantityScreen); }
        }
 
        private void LoadAdjustQuantityScreen()
        {
            PushViewModel(new AdjustQuantityViewModel(ViewModelChanger, SelectedItem) { CurrentUser = CurrentUser });
        }
 
        public ICommand GoToMainMenu
        {
            get { return new RelayCommand(PopToMainMenu); }
        }
 
        private void PopToMainMenu()
        {
            PopViewModel();
        }
 
        public void CreatedInventoryItem(InventoryItem item)
        {
            Items.Add(item);
        }
 
        public void DeleteItem(InventoryItem item)
        {
            if (item != null)
            {
                item.Delete();
                Items.Remove(item);
            }
        }
 
        public ICommand MoveToViewQuantityChangesScreen
        {
            get { return new RelayCommand(LoadViewQuantityChangesScreen); }
        }
 
        private void LoadViewQuantityChangesScreen()
        {
            if (SelectedItem != null)
            {
                PushViewModel(new ViewQuantityAdjustmentsViewModel(ViewModelChanger, SelectedItem) { CurrentUser = CurrentUser });
            }
        }
    }
}
Updating Total Value is done above,
Now, we will create a main controller to invoke methods,
using SimpleInventory.Helpers;
using SimpleInventory.Interfaces;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;
using System.Windows.Threading;
 
namespace SimpleInventory.ViewModels
{
    class MainWindowViewModel : ChangeNotifier, IChangeViewModel
    {
        BaseViewModel _currentViewModel;
        Stack<BaseViewModel> _viewModels;
 
        // logic for inactivity
        private readonly DispatcherTimer _activityTimer;
 
        public MainWindowViewModel()
        {
            // upgrading settings
            if (Properties.Settings.Default.UpgradeRequired)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeRequired = false;
                Properties.Settings.Default.Save();
            }
 
            _viewModels = new Stack<BaseViewModel>();
            var initialViewModel = new LoginViewModel(this);
            _viewModels.Push(initialViewModel);
            CurrentViewModel = initialViewModel;
            // setup inactivity timer
            InputManager.Current.PreProcessInput += InputPreProcessInput;
            _activityTimer = new DispatcherTimer { Interval = TimeSpan.FromMinutes(10), IsEnabled = true };
            _activityTimer.Tick += ActivityTimerTick;
        }
 
        public BaseViewModel CurrentViewModel
        {
            get { return _currentViewModel; }
            set { _currentViewModel = value; NotifyPropertyChanged(); }
        }
 
        private void ActivityTimerTick(object sender, EventArgs e)
        {
            // set UI to inactivity
            PopToBaseViewModel();
        }
 
        private void InputPreProcessInput(object sender, PreProcessInputEventArgs e)
        {
            InputEventArgs inputEventArgs = e.StagingItem.Input;
 
            if (inputEventArgs is MouseEventArgs || inputEventArgs is KeyboardEventArgs)
            {
                // reset timer
                _activityTimer.Stop();
                _activityTimer.Start();
            }
        }
 
        #region IChangeViewModel
 
        public void PushViewModel(BaseViewModel model)
        {
            _viewModels.Push(model);
            CurrentViewModel = model;
        }
 
        public void PopViewModel()
        {
            if (_viewModels.Count > 1)
            {
                _viewModels.Pop();
            }
            CurrentViewModel = _viewModels.Peek();
        }
 
        public void PopToBaseViewModel()
        {
            while (_viewModels.Count > 1)
            {
                _viewModels.Pop();
                CurrentViewModel = _viewModels.Peek();
            }
        }
 
        #endregion
    }
}

Here, we have invoked methods to be used for the purpose.


Related Solutions

Create an application that allows the user to enter the total for an order and the...
Create an application that allows the user to enter the total for an order and the name of the customer. If the order is less than 500 dollars, the customer gets no discount. If the order is greater than or equal to 500 and less than 1000 dollars, the customer gets a 5 percent discount. If the order is greater than or equal to 1000 dollars, the customer gets a 10 percent discount. The application should display the name of...
Create an application that allows the user to enter the total for an order and the...
Create an application that allows the user to enter the total for an order and the name of the customer. If the order is less than 500 dollars, the customer gets no discount. If the order is greater than or equal to 500 and less than 1000 dollars, the customer gets a 5 percent discount. If the order is greater than or equal to 1000 dollars, the customer gets a 10 percent discount. The application should display the name of...
Write a C++ program that : 1. Allow the user to enter the size of the...
Write a C++ program that : 1. Allow the user to enter the size of the matrix such as N. N must be an integer that is >= 2 and < 11. 2. Create an vector of size N x N. 3. Call a function to do the following : Populate the vector with N2 distinct random numbers. Display the created array. 4. Call a function to determines whether the numbers in n x n vector satisfy the perfect matrix...
Allow the user to enter the number of people in the party. Calculate and display the...
Allow the user to enter the number of people in the party. Calculate and display the amount owed by each person if the bill were to be split evenly among the party members. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.mdc.tippcalcula"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> </application> </manifest> ------------------------------- <?xml version="1.0" encoding="utf-8"?> <GridLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:columnCount="2" android:useDefaultMargins="true" tools:context=".MainActivity"> <EditText android:id="@+id/amountEditText" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:hint="" android:digits="0123456789" android:inputType="number"...
Forms often allow a user to enter an integer. Write a program that takes in a...
Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9. Ex: If the input is: 1995 the output is: yes Ex: If the input is: 42,000 or any string with a non-integer character, the output is: no PYTHON 3
Forms often allow a user to enter an integer. Write a programthat takes in a...
Forms often allow a user to enter an integer. Write a program that takes in a string representing an integer as input, and outputs yes if every character is a digit 0-9
create a program that will allow the user to enter a start value from 1 to...
create a program that will allow the user to enter a start value from 1 to 5, a stop value from 10 to 12 and a multiplier from 1 to 4. the program must display a multiplication table from the values entered. for example if the user enters: start 2, stop 10 and multiplier 3, the table should appear as follows: 3*2=6 3*3=9 3*4=12 . . . 3*10=30
In c++, modify this program so that you allow the user to enter the min and...
In c++, modify this program so that you allow the user to enter the min and maximum values (In this case they cannot be defined as constants, why?). // This program demonstrates random numbers. #include <iostream> #include <cstdlib> // rand and srand #include <ctime> // For the time function using namespace std; int main() { // Get the system time. unsigned seed = time(0); // Seed the random number generator. srand(seed); // Display three random numbers. cout << rand() <<...
Modify the Tip Calculator app to allow the user to enter the number of people in...
Modify the Tip Calculator app to allow the user to enter the number of people in the party. Calculate and display the amount owed by each person if the bill were to be split evenly among the party members. Code: ----------------TipCalculator.java----------------------- import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class TipCalculator extends Application { @Override public void start(Stage stage) throws Exception { Parent root = FXMLLoader.load(getClass().getResource("TipCalculator.fxml")); Scene scene = new Scene(root); // attach scene graph to scene...
For this exercise, you will implement two programs that allow the user to enter grades in...
For this exercise, you will implement two programs that allow the user to enter grades in a gradebook. The first program will use one‐dimensional arrays, and the second program will use two‐dimensional arrays. The two programs function the same Write an application that prints out the final grade of the students in a class and the average for the whole class. There are a total of 3 quizzes. You will need 4 arrays: 1. An array of type int to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT