Add logic to tell me to switch to unlimited if I go over $75. Use C++
/*******************************************************************************
** Program Name: Verizons Monthly Bill Calculator.
** File Name: file a03.cpp.
** Author: Natassha Quiroz
** Date: October 18, 2020 (updated 10/20/20)
** Assignment: 03
** Description: The purpose of this program is to calculate the
consumers monthly cell
** phone bill based on data usage.
** Sources: Lecture slides, lecture videos and practice programs
from lecture video.
*******************************************************************************/
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
// declaring constants.
const int PLANS = 35;
const int PLANM = 50;
const int PLANL = 70;
const int PLANU = 75;
// declaring variables.
char planchoice;
double total = 0.0, data = 0.0;
//This while will continue to prompt the question until the user
enters a valid response.
while (true)
{
// displaying the menu
cout << "S = Plan A" << endl;
cout << "M = Plan B" << endl;
cout << "L = Plan C" << endl;
cout << "U = Plan unlimited" << endl;
// getting the plan plan choice entered by the user
cout << "Which one of these plans do you have? ";
cin >> planchoice;
// Checking whether the user entered a valid plan choice
if (planchoice != 'S' && planchoice != 's' &&
planchoice != 'M'
&& planchoice != 'm' && planchoice != 'L'
&& planchoice != 'l' && planchoice != 'U'
&& planchoice != 'u')
{
cout << "** Invalid Plan Choice **" << endl;
}
else
break;
}
// getting the choice entered by the user
cout << "How many GB have you used so far? ";
cin >> data;
data = ceil(data);
// Based on the user plan choice the corresponding case will be
executed
switch (planchoice)
{
case 'S':
case 's':
{
if (data <= 2)
{
total = PLANS;
}
else
{
total = PLANS;
for (int i = 1; i <= data - 2; i++)
{
total += 15;
}
}
break;
}
case 'M':
case 'm':
{
if (data <= 2)
{
total = PLANM;
}
else
{
total = PLANM;
for (int i = 1; i <= data - 2; i++)
{
total += 15;
}
}
break;
}
case 'L':
case 'l':
{
if (data <= 2)
{
total = PLANL;
}
else
{
total = PLANL;
for (int i = 1; i <= data - 2; i++)
{
total += 15;
}
}
break;
}
case 'U':
case 'u':
{
total = PLANU;
break;
}
}
// display the customers total charge
cout << "Total Charges :$" << total << endl;
return 0;
}
In: Computer Science
Locate your Student project from the previous in-class assignment. You will add a new class to that project.
1. Create a class called Course. It should have a field to hold an ArrayList of Student objects.
2. Create a constructor for Course that accepts an ArrayList of Student objects, and set field to the parameter.
3. In the Course class, create a method called addStudent(Student s). This should add the parameter "s" to the ArrayList of Student objects.
4. In the Course class, create a method called removeStudent(Student s). This method should remove the parameter"s" from the ArrayList of Student objects.
5. In the Course class, create a method called toString(). This method should return a String showing the information from all the Student objects in the ArrayList. It should be formatted in the following way:
"Student 0: *Student 0 toString()*
Student 1: *Student 1 toString()*
...
Student n: *Student n toString()*"
This method should call each Student object's toString() method, as shown in the above example.
MY CODE :
student.java
package student;
public class Student {
public static void main(String[] args) {
Course myNewCourse = new Course(2) ;
System.out.println(myNewCourse.toString());
}
private int idNum;
private String firstN;
private String lastN;
public Student(int studentId, String firstName, String lastName ){
idNum = studentId;
firstN = firstName;
lastN = lastName;
}
public String toString(){
String allData = "Student"+"1"+":ID: "+getIdNum()+ ", First name:
"
+ getFirstName()+ ", Last name: " +getLastName()+ "." ;
return allData;
}
public void setIdNum(int studentId){
this.idNum = studentId;
}
public void setFirstName(String firstName){
this.firstN = firstName;
}
public void setLastName(String lastName){
this.lastN = lastName;
}
public int getIdNum(){
return idNum;
}
public String getFirstName(){
return firstN;
}
public String getLastName() {
return lastN;
}
}
course.java
/*
* To change this license header, choose License Headers in Project
Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package student;
import java.util.ArrayList;
/**
*
* @author farha
*/
public class Course {
ArrayList<Student> students = new
ArrayList<Student>();
public Course(ArrayList<Student> students){
this.students = students;
}
public void addStudent(Student s){
students.add(0, s);
}
public void removeStudent(Student s){
students.remove(s);
}
public String toString(){
String information = ("");
return information;
}
}
In: Computer Science
Please fllll this out thank you
/**
*
* Creates a six-sided die and rolls it 20 times. It outputs the
face values and also
* the number of times the die lands on 6.
*
* Creates 2 eight-sided dice and rolls the pair 10 times. It prints
out a sequence
* of pairs representing the face values as well as the number of
doubles.
*
* Allows the user to repeat the above steps as often as (s)he
wishes.
*
* @author (put your name here!!!)
* @version (3-20-19)
*/
import java.util.*;
public class TestDie
{
public static void main (String [] args)
{
Scanner keyIn = new Scanner(System.in);
// display output heading
System.out.println ("Programmer: put your name here!!");
System.out.println ("Course: COSC 111, Winter '19");
System.out.println ("Lab: Exam 2, part 2");
System.out.println ("Due date: 3-20-19\n");
// create a six-sided die
// create a Die object and then call the method setSides to set the
number of sides to 6
// roll the die 20 times, output the face value of each roll (4 per
line), and the
// number of times the die lands on 6.
// set up a loop that iterates exactly 20 times, and each time
through the loop do the following:
// roll the die by calling the method 'roll'; output the face value
of the die; check the face
// value to keep track of 6s, and check to see if you have printed
4 numbers already, if yes,
// then advance to the next line.
System.out.println("Rolling a 6-sided die 20 times:" );
// create two eight-sided dice
// create two 'Die' objects and then use the method 'setSides' with
each object to set its number of sides to 8
System.out.println("\nRolling a pair of 8-sided dice 10 times:");
// throw a pair of eight-sided dice 10 times, output the face
values of each throw as a pair
// and also the number of doubles (both dice land on the same face
value)
// set up a loop that iterates exactly 10 times, and each time
through the loop do the following:
// roll both die by calling the method 'roll' twice; print out
their face values as a pair;
// and check to see if both face values are the same, if yes, keep
track of it.
// add a do-while loop to repeat the above code as often as the user wishes
}
}
In: Computer Science
what is the density of a 50% (m/v) solution of glycerol
In: Chemistry
brief IRAC of case 40.1 Oliveira v. Sugarman
In: Finance
A neutron collides elastically with a helium nucleus (at rest initially) whose mass is four times that of the neutron. The helium nucleus is observed to move off at an angle θ′2=45∘. The neutron's initial speed is 6.6×105 m/s .
the angle of the neutron after the collision: 76 below the initial direction of the neutron
Determine the speeds of the two particles, v′n and v′He, after the collision.
In: Physics
MATLAB question
The range of a projectile launched at velocity V and angle q
is R=2 V2 sin(q) cos(q)
What should the accuracy of the launch angle have be to keep the uncertainty of the range to within 5%.
In: Advanced Math